changeset 6886:6b4bd5d667cd libavcodec

set audio parameters if frame header is ok, even if crc fails
author jbr
date Sun, 25 May 2008 18:54:17 +0000
parents 5554f5ab2c19
children 1b346861c9dc
files ac3dec.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Sun May 25 18:06:01 2008 +0000
+++ b/ac3dec.c	Sun May 25 18:54:17 2008 +0000
@@ -1181,15 +1181,15 @@
     }
 
     /* check for crc mismatch */
-    if(avctx->error_resilience >= FF_ER_CAREFUL) {
+    if(!err && avctx->error_resilience >= FF_ER_CAREFUL) {
         if(av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], s->frame_size-2)) {
             av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
             err = 1;
         }
     }
 
-    /* if frame is ok, set audio parameters */
-    if (!err) {
+    /* if frame header is ok, set audio parameters */
+    if (err >= 0) {
         avctx->sample_rate = s->sample_rate;
         avctx->bit_rate = s->bit_rate;