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, ...@@ -933,6 +933,7 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder,
} }
while (i < pcm_length) { while (i < pcm_length) {
enum decoder_command cmd;
unsigned int num_samples = unsigned int num_samples =
(data->outputBufferEnd - data->outputPtr) / (data->outputBufferEnd - data->outputPtr) /
(2 * MAD_NCHANNELS(&(data->frame).header)); (2 * MAD_NCHANNELS(&(data->frame).header));
...@@ -947,8 +948,6 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, ...@@ -947,8 +948,6 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder,
MAD_NCHANNELS(&(data->frame).header)); MAD_NCHANNELS(&(data->frame).header));
data->outputPtr += 2 * num_samples; data->outputPtr += 2 * num_samples;
if (data->outputPtr >= data->outputBufferEnd) {
enum decoder_command cmd;
cmd = decoder_data(decoder, data->inStream, cmd = decoder_data(decoder, data->inStream,
data->inStream->seekable, data->inStream->seekable,
data->outputBuffer, data->outputBuffer,
...@@ -963,7 +962,6 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder, ...@@ -963,7 +962,6 @@ static int mp3Read(mp3DecodeData * data, struct decoder *decoder,
data->outputPtr = data->outputBuffer; data->outputPtr = data->outputBuffer;
} }
}
if (data->dropSamplesAtEnd && if (data->dropSamplesAtEnd &&
(data->currentFrame == data->maxFrames - data->dropFramesAtEnd)) (data->currentFrame == data->maxFrames - data->dropFramesAtEnd))
......
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