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.
This commit is contained in:
Max Kellermann 2008-08-26 08:27:12 +02:00
parent af83ac5ec6
commit 2e8bd3ae1d

View File

@ -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 &&