diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2006-12-23 15:10:21 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2006-12-23 15:10:21 +0000 |
commit | 5da19e5f788be65b3516524823ee23621a897216 (patch) | |
tree | 04c93b49be19897cabc3ecaf40ed12caef3f1ec3 | |
parent | 469ff630932ce2ca0fa4874c5a8bff7fa2ead025 (diff) | |
download | mpd-5da19e5f788be65b3516524823ee23621a897216.tar.gz mpd-5da19e5f788be65b3516524823ee23621a897216.tar.xz mpd-5da19e5f788be65b3516524823ee23621a897216.zip |
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
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 7838624ab..b20118da4 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -835,15 +835,17 @@ static int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc, for (i = 0; i < (data->synth).pcm.length; i++) { mpd_sint16 *sample; + samplesLeft--; + if (!data->decodedFirstFrame && (i < data->dropSamplesAtStart)) { continue; } else if (data->dropSamplesAtEnd && - (data->currentFrame == (data->maxFrames - data->dropFramesAtEnd))) { - samplesLeft--; - /* stop decoding, since samples were dropped */ - if (samplesLeft < data->dropSamplesAtEnd) - return DECODE_BREAK; + (data->currentFrame == (data->maxFrames - data->dropFramesAtEnd)) && + (samplesLeft < data->dropSamplesAtEnd)) { + /* stop decoding, effectively dropping + * all remaining samples */ + return DECODE_BREAK; } sample = (mpd_sint16 *) data->outputPtr; |