Make decoder more robust by default against broken encoders.
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Sep 2008 00:31:32 +0000 (00:31 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Sep 2008 00:31:32 +0000 (00:31 +0000)
Fixes issue540.

Originally committed as revision 15336 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpegaudiodec.c

index ce80217..a0b7e35 100644 (file)
@@ -1599,7 +1599,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
     /* skip extension bits */
     bits_left = end_pos2 - get_bits_count(&s->gb);
 //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
-    if (bits_left < 0/* || bits_left > 500*/) {
+    if (bits_left < 0 && s->error_recognition >= FF_ER_COMPLIANT) {
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
         s_index=0;
     }else if(bits_left > 0 && s->error_recognition >= FF_ER_AGGRESSIVE){