Commit 5da19e5f authored by J. Alexander Treuman's avatar J. Alexander Treuman

Properly calculate the number of remaining samples in the MP3 frame, even

though in practice it should never matter. git-svn-id: https://svn.musicpd.org/mpd/trunk@5147 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 469ff630
...@@ -835,14 +835,16 @@ static int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc, ...@@ -835,14 +835,16 @@ static int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc,
for (i = 0; i < (data->synth).pcm.length; i++) { for (i = 0; i < (data->synth).pcm.length; i++) {
mpd_sint16 *sample; mpd_sint16 *sample;
samplesLeft--;
if (!data->decodedFirstFrame && if (!data->decodedFirstFrame &&
(i < data->dropSamplesAtStart)) { (i < data->dropSamplesAtStart)) {
continue; continue;
} else if (data->dropSamplesAtEnd && } else if (data->dropSamplesAtEnd &&
(data->currentFrame == (data->maxFrames - data->dropFramesAtEnd))) { (data->currentFrame == (data->maxFrames - data->dropFramesAtEnd)) &&
samplesLeft--; (samplesLeft < data->dropSamplesAtEnd)) {
/* stop decoding, since samples were dropped */ /* stop decoding, effectively dropping
if (samplesLeft < data->dropSamplesAtEnd) * all remaining samples */
return DECODE_BREAK; return DECODE_BREAK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment