diff mpegvideo.c @ 1393:ba99a78bcb37 libavcodec

make the h263 decoder more error tolerant
author michaelni
date Fri, 01 Aug 2003 11:00:03 +0000
parents da0b3a50d209
children b2ac20ff1458
line wrap: on
line diff
--- a/mpegvideo.c	Tue Jul 29 14:15:28 2003 +0000
+++ b/mpegvideo.c	Fri Aug 01 11:00:03 2003 +0000
@@ -1004,6 +1004,14 @@
     if(s->next_picture_ptr) s->next_picture= *s->next_picture_ptr;
     if(s->new_picture_ptr ) s->new_picture = *s->new_picture_ptr;
     
+    if(s->pict_type != I_TYPE && s->last_picture_ptr==NULL){
+        fprintf(stderr, "warning: first frame is no keyframe\n");
+        assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
+        goto alloc;
+    }
+
+    assert(s->pict_type == I_TYPE || (s->last_picture_ptr && s->last_picture_ptr->data[0]));
+
     if(s->picture_structure!=PICT_FRAME){
         int i;
         for(i=0; i<4; i++){
@@ -1015,12 +1023,6 @@
             s->next_picture.linesize[i] *=2;
         }
     }
-    
-    if(s->pict_type != I_TYPE && s->last_picture_ptr==NULL){
-        fprintf(stderr, "warning: first frame is no keyframe\n");
-        assert(s->pict_type != B_TYPE); //these should have been dropped if we dont have a reference
-        goto alloc;
-    }
   }
    
     s->hurry_up= s->avctx->hurry_up;