[FFmpeg-devel] [PATCH] Always copy input data for AC3 decoder.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Mar 19 12:28:00 CET 2011


Depending on error_recognition is not correct, low values do
certainly not mean it is ok to crash.
---
 libavcodec/ac3dec.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index fbcfdb0..2ced354 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1308,8 +1308,6 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
     // if it seems to be byte-swapped AC-3 (aka DNET)
     int is_swapped = buf_size >= 2 && AV_RB16(buf) == 0x770B;
 
-    /* initialize the GetBitContext with the start of valid AC-3 Frame */
-    if (is_swapped || avctx->error_recognition >= FF_ER_CAREFUL) {
         /* allocate context input buffer */
         if (!s->input_buffer)
             s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
@@ -1324,7 +1322,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
         } else
         memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
         buf = s->input_buffer;
-    }
+    /* initialize the GetBitContext with the start of valid AC-3 Frame */
     init_get_bits(&s->gbc, buf, buf_size * 8);
 
     /* parse the syncinfo */
-- 
1.7.4.1




More information about the ffmpeg-devel mailing list