aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/aac_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-12 08:32:21 +0100
committerMax Kellermann <max@duempel.org>2008-11-12 08:32:21 +0100
commitb67a8e4d6e532c465dca6b68de6cc8e378069c03 (patch)
tree9d6143593d26f996eb719e59cb34819725994bfc /src/decoder/aac_plugin.c
parent432da18e44aaf5f6c62d50a033cb6fe0a9bea148 (diff)
downloadmpd-b67a8e4d6e532c465dca6b68de6cc8e378069c03.tar.gz
mpd-b67a8e4d6e532c465dca6b68de6cc8e378069c03.tar.xz
mpd-b67a8e4d6e532c465dca6b68de6cc8e378069c03.zip
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.
Diffstat (limited to 'src/decoder/aac_plugin.c')
-rw-r--r--src/decoder/aac_plugin.c9
1 files changed, 5 insertions, 4 deletions
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);