Commit 2e8bd3ae authored by Max Kellermann's avatar Max Kellermann

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.
parent af83ac5e
......@@ -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 &&
......
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