diff h263dec.c @ 1183:03b97d87dcdd libavcodec

10l (use before malloc)
author michaelni
date Sat, 12 Apr 2003 15:00:32 +0000
parents fea03d2c4946
children 126f766bc4c5
line wrap: on
line diff
--- a/h263dec.c	Fri Apr 11 22:53:03 2003 +0000
+++ b/h263dec.c	Sat Apr 12 15:00:32 2003 +0000
@@ -643,14 +643,21 @@
 
     ff_er_frame_start(s);
     
+    //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type
+    //which isnt available before MPV_frame_start()
+    if (s->msmpeg4_version==5){
+        if(ff_wmv2_decode_secondary_picture_header(s) < 0)
+            return -1;
+    }
+
     /* decode each macroblock */
     s->mb_x=0; 
     s->mb_y=0;
     
     decode_slice(s);
-    while(s->mb_y<s->mb_height && s->gb.size_in_bits - get_bits_count(&s->gb)>16){
+    while(s->mb_y<s->mb_height){
         if(s->msmpeg4_version){
-            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0)
+            if(s->mb_x!=0 || (s->mb_y%s->slice_height)!=0 || get_bits_count(&s->gb) > s->gb.size_in_bits)
                 break;
         }else{
             if(ff_h263_resync(s)<0)
@@ -733,7 +740,6 @@
         *pict= *(AVFrame*)&s->last_picture;
         ff_print_debug_info(s, s->last_picture_ptr);
     }
-    
 
     /* Return the Picture timestamp as the frame number */
     /* we substract 1 because it is added on utils.c    */