[FFmpeg-soc] [soc]: r1758 - eac3/ac3dec.c

jbr subversion at mplayerhq.hu
Thu Jan 3 03:18:00 CET 2008


Author: jbr
Date: Thu Jan  3 03:17:59 2008
New Revision: 1758

Log:
add crc check

Modified:
   eac3/ac3dec.c

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Thu Jan  3 03:17:59 2008
@@ -35,6 +35,7 @@
 #include "avcodec.h"
 #include "ac3_parser.h"
 #include "bitstream.h"
+#include "crc.h"
 #include "dsputil.h"
 #include "random.h"
 #include "ac3dec.h"
@@ -1025,15 +1026,21 @@ static int ac3_decode_frame(AVCodecConte
         return -1;
     }
 
-    avctx->sample_rate = s->sample_rate;
-    avctx->bit_rate = s->bit_rate;
-
     /* check that reported frame size fits in input buffer */
     if(s->frame_size > buf_size) {
         av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
         return -1;
     }
 
+    /* check for crc mismatch */
+    if(av_crc(av_crc8005, 0, &buf[2], s->frame_size-2)) {
+        av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
+        return -1;
+    }
+
+    avctx->sample_rate = s->sample_rate;
+    avctx->bit_rate = s->bit_rate;
+
     /* channel config */
     s->out_channels = s->channels;
     if (avctx->request_channels > 0 && avctx->request_channels <= 2 &&



More information about the FFmpeg-soc mailing list