From b67a8e4d6e532c465dca6b68de6cc8e378069c03 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 12 Nov 2008 08:32:21 +0100 Subject: aac: shift the input buffer before the full check When the buffer was full, but everything was already consumed, fillAacBuffer() would not attempt to flush and refill it. --- src/decoder/aac_plugin.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/decoder/aac_plugin.c b/src/decoder/aac_plugin.c index aed121308..1817f9cf4 100644 --- a/src/decoder/aac_plugin.c +++ b/src/decoder/aac_plugin.c @@ -53,13 +53,14 @@ static void fillAacBuffer(AacBuffer * b) { size_t rest, bread; - if (b->bytesIntoBuffer >= sizeof(b->buffer)) + if (b->bytesConsumed > 0) + aac_buffer_shift(b, b->bytesConsumed); + + rest = sizeof(b->buffer) - b->bytesIntoBuffer; + if (rest == 0) /* buffer already full */ return; - aac_buffer_shift(b, b->bytesConsumed); - - rest = sizeof(b->buffer) - b->bytesIntoBuffer; bread = decoder_read(b->decoder, b->inStream, (void *)(b->buffer + b->bytesIntoBuffer), rest); -- cgit v1.2.3