changeset 11746:818851623979 libavcodec

Make aac_decode_frame() consume zero padding at the end of a packet.
author alexc
date Wed, 19 May 2010 20:18:34 +0000
parents 0cb0697b7f57
children 3a150ee29655
files aac.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/aac.c	Wed May 19 20:13:50 2010 +0000
+++ b/aac.c	Wed May 19 20:18:34 2010 +0000
@@ -1954,6 +1954,7 @@
     int err, elem_id, data_size_tmp;
     int buf_consumed;
     int samples = 1024, multiplier;
+    int buf_offset;
 
     init_get_bits(&gb, buf, buf_size * 8);
 
@@ -2065,7 +2066,11 @@
         ac->output_configured = OC_LOCKED;
 
     buf_consumed = (get_bits_count(&gb) + 7) >> 3;
-    return buf_size > buf_consumed ? buf_consumed : buf_size;
+    for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++)
+        if (buf[buf_offset])
+            break;
+
+    return buf_size > buf_offset ? buf_consumed : buf_size;
 }
 
 static av_cold int aac_decode_close(AVCodecContext *avccontext)