diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index a676e3f5aa..bbc7e1c79e 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -356,6 +356,11 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t * return GET_BUFFER_DONE; } + self->samples_decoded += *buffer_length / sizeof(int16_t); + + mp3file_skip_id3v2(self); + int result = mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE; + if (self->inbuf_offset >= 512) { background_callback_add( &self->inbuf_fill_cb, @@ -363,8 +368,7 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t * self); } - self->samples_decoded += *buffer_length / sizeof(int16_t); - return mp3file_find_sync_word(self) ? GET_BUFFER_MORE_DATA : GET_BUFFER_DONE; + return result; } void audiomp3_mp3file_get_buffer_structure(audiomp3_mp3file_obj_t *self, bool single_channel_output,