# HG changeset patch # User Chris Cannam # Date 1480437929 0 # Node ID aa1b1fc2d01812050afb445a71c8e962f7d4b2e5 # Parent 2e7fcdd5f627d9074309c51f839d08c91916b3b4 Stop reporting sync errors only when we really are at eof, i.e. after the input callback has been called again (previously we just tested whether we'd buffered up all the input, which of course we do in one go at the start) diff -r 2e7fcdd5f627 -r aa1b1fc2d018 data/fileio/MP3FileReader.cpp --- a/data/fileio/MP3FileReader.cpp Tue Nov 29 14:35:27 2016 +0000 +++ b/data/fileio/MP3FileReader.cpp Tue Nov 29 16:45:29 2016 +0000 @@ -317,6 +317,7 @@ data.start = (unsigned char const *)mm; data.length = sz; + data.finished = false; data.reader = this; mad_decoder_init(&decoder, // decoder to initialise @@ -343,7 +344,10 @@ { DecoderData *data = (DecoderData *)dp; - if (!data->length) return MAD_FLOW_STOP; + if (!data->length) { + data->finished = true; + return MAD_FLOW_STOP; + } unsigned char const *start = data->start; sv_frame_t length = data->length; @@ -569,8 +573,9 @@ DecoderData *data = (DecoderData *)dp; if (stream->error == MAD_ERROR_LOSTSYNC && - data->length == 0) { - // We are at end of file, losing sync is expected behaviour + data->finished) { + // We are at end of file, losing sync is expected behaviour, + // don't report it return MAD_FLOW_CONTINUE; } diff -r 2e7fcdd5f627 -r aa1b1fc2d018 data/fileio/MP3FileReader.h --- a/data/fileio/MP3FileReader.h Tue Nov 29 14:35:27 2016 +0000 +++ b/data/fileio/MP3FileReader.h Tue Nov 29 16:45:29 2016 +0000 @@ -124,6 +124,7 @@ struct DecoderData { unsigned char const *start; sv_frame_t length; + bool finished; MP3FileReader *reader; };