Skip to content

Commit

Permalink
MP3: look harder for frame info
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jepler committed Dec 14, 2019
1 parent bf9b7e7 commit 91a1706
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion shared-module/audiomp3/MP3File.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,15 @@ STATIC bool mp3file_find_sync_word(audiomp3_mp3file_obj_t* self) {
}

STATIC bool mp3file_get_next_frame_info(audiomp3_mp3file_obj_t* self, MP3FrameInfo* fi) {
int err = MP3GetNextFrameInfo(self->decoder, fi, READ_PTR(self));
int err;
do {
err = MP3GetNextFrameInfo(self->decoder, fi, READ_PTR(self));
if (err == ERR_MP3_NONE) {
break;
}
CONSUME(self, 1);
mp3file_find_sync_word(self);
} while (!self->eof);
return err == ERR_MP3_NONE;
}

Expand Down

0 comments on commit 91a1706

Please sign in to comment.