Skip to content

Commit 91a1706

Browse files
committed
MP3: look harder for frame info
Apparently sometimes, a proper "frame info" block is not found after a "sync word". Keep looking for one as needed, instead of giving up after one try. This was one reason that the "bartlebeats" mp3s would not play.
1 parent bf9b7e7 commit 91a1706

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

shared-module/audiomp3/MP3File.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,15 @@ STATIC bool mp3file_find_sync_word(audiomp3_mp3file_obj_t* self) {
139139
}
140140

141141
STATIC bool mp3file_get_next_frame_info(audiomp3_mp3file_obj_t* self, MP3FrameInfo* fi) {
142-
int err = MP3GetNextFrameInfo(self->decoder, fi, READ_PTR(self));
142+
int err;
143+
do {
144+
err = MP3GetNextFrameInfo(self->decoder, fi, READ_PTR(self));
145+
if (err == ERR_MP3_NONE) {
146+
break;
147+
}
148+
CONSUME(self, 1);
149+
mp3file_find_sync_word(self);
150+
} while (!self->eof);
143151
return err == ERR_MP3_NONE;
144152
}
145153

0 commit comments

Comments
 (0)