Fix ticket127
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 22 May 2011 17:06:10 +0000 (19:06 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 22 May 2011 19:31:27 +0000 (21:31 +0200)
This fixes detectiion of slightly too big dummy frames.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/h263dec.c

index b56fd06..bf6a856 100644 (file)
@@ -681,22 +681,18 @@ retry:
 frame_end:
     /* divx 5.01+ bistream reorder stuff */
     if(s->codec_id==CODEC_ID_MPEG4 && s->divx_packed){
-        int current_pos= get_bits_count(&s->gb)>>3;
+        int current_pos= s->gb.buffer == s->bitstream_buffer ? 0 : (get_bits_count(&s->gb)>>3);
         int startcode_found=0;
 
         if(buf_size - current_pos > 5){
             int i;
-            for(i=current_pos; i<buf_size-3; i++){
+            for(i=current_pos; i<buf_size-4; i++){
                 if(buf[i]==0 && buf[i+1]==0 && buf[i+2]==1 && buf[i+3]==0xB6){
-                    startcode_found=1;
+                    startcode_found=!(buf[i+4]&0x40);
                     break;
                 }
             }
         }
-        if(s->gb.buffer == s->bitstream_buffer && buf_size>7 && s->xvid_build>=0){ //xvid style
-            startcode_found=1;
-            current_pos=0;
-        }
 
         if(startcode_found){
             av_fast_malloc(