diff options
author | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:12 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-26 08:27:12 +0200 |
commit | 2e8bd3ae1d3ad9b3d4f6e59d90414a45414a96f7 (patch) | |
tree | 4bdcd812f2efb8218c8dd1bcfbf7bc83c4c90820 /src/inputPlugins | |
parent | af83ac5ec6c29be8b95513ad65dace6cecab617a (diff) | |
download | mpd-2e8bd3ae1d3ad9b3d4f6e59d90414a45414a96f7.tar.gz mpd-2e8bd3ae1d3ad9b3d4f6e59d90414a45414a96f7.tar.xz mpd-2e8bd3ae1d3ad9b3d4f6e59d90414a45414a96f7.zip |
mp3: always flush directly after decoding/dithering
Since we try to fill the buffer in every iteration, we assume that we
should flush the output buffer at the end of each iteration.
Diffstat (limited to '')
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 0a99cab21..27f26db67 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -933,6 +933,7 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, } while (i < pcm_length) { + enum decoder_command cmd; unsigned int num_samples = (data->outputBufferEnd - data->outputPtr) / (2 * MAD_NCHANNELS(&(data->frame).header)); @@ -947,22 +948,19 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, MAD_NCHANNELS(&(data->frame).header)); data->outputPtr += 2 * num_samples; - if (data->outputPtr >= data->outputBufferEnd) { - enum decoder_command cmd; - cmd = decoder_data(decoder, data->inStream, - data->inStream->seekable, - data->outputBuffer, - data->outputPtr - data->outputBuffer, - data->elapsedTime, - data->bitRate / 1000, - (replayGainInfo != NULL) ? *replayGainInfo : NULL); - if (cmd == DECODE_COMMAND_STOP) { - data->flush = 0; - return DECODE_BREAK; - } - - data->outputPtr = data->outputBuffer; + cmd = decoder_data(decoder, data->inStream, + data->inStream->seekable, + data->outputBuffer, + data->outputPtr - data->outputBuffer, + data->elapsedTime, + data->bitRate / 1000, + (replayGainInfo != NULL) ? *replayGainInfo : NULL); + if (cmd == DECODE_COMMAND_STOP) { + data->flush = 0; + return DECODE_BREAK; } + + data->outputPtr = data->outputBuffer; } if (data->dropSamplesAtEnd && |