minimp3: Fix seeking behavior

Seeking should clear the sample buffer if it contains anything, and non-
seekable files should return an error on an attempt to seek.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-03-23 16:18:07 -07:00
parent 11eeaea6e2
commit 6e8538c7c9

View file

@ -290,6 +290,9 @@ static int mp3_seek_callback(uint64_t position, void *user_data) {
if(error < 0) { if(error < 0) {
return -1; return -1;
} }
samples_filled = 0;
} else {
return -1;
} }
seconds = (double)frame / (double)_decoder_info.hz; seconds = (double)frame / (double)_decoder_info.hz;