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:
parent
af83ac5ec6
commit
2e8bd3ae1d
@ -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 &&
|
||||
|
Loading…
Reference in New Issue
Block a user