From c16d5a6f146d7fb4858eb00d577c0aecc1a6aee9 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Wed, 19 May 2010 20:18:34 +0000 Subject: [PATCH] Make aac_decode_frame() consume zero padding at the end of a packet. Originally committed as revision 23195 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/aac.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/aac.c b/libavcodec/aac.c index ac8c9c6..3330e1c 100644 --- a/libavcodec/aac.c +++ b/libavcodec/aac.c @@ -1954,6 +1954,7 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, 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 @@ static int aac_decode_frame(AVCodecContext *avccontext, void *data, 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) -- 2.7.4