changeset 339:b743a6bbab25 libavcodec

segfault fix
author michaelni
date Mon, 22 Apr 2002 21:02:18 +0000
parents 1a38b3b4ea28
children f24c77638413
files h263.c mpegvideo.c
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/h263.c	Mon Apr 22 19:57:45 2002 +0000
+++ b/h263.c	Mon Apr 22 21:02:18 2002 +0000
@@ -359,8 +359,13 @@
                     uint8_t *p_pic= s->new_picture[0] + offset;
                     s->mb_skiped=1;
                     for(i=0; i<s->max_b_frames; i++){
-                        uint8_t *b_pic= s->coded_order[i+1].picture[0] + offset;
-                        int diff= pix_abs16x16(p_pic, b_pic, s->linesize);
+                        uint8_t *b_pic;
+                        int diff;
+
+                        if(s->coded_order[i+1].pict_type!=B_TYPE) break;
+
+                        b_pic= s->coded_order[i+1].picture[0] + offset;
+                        diff= pix_abs16x16(p_pic, b_pic, s->linesize);
                         if(diff>s->qscale*70){
                             s->mb_skiped=0;
                             break;
--- a/mpegvideo.c	Mon Apr 22 19:57:45 2002 +0000
+++ b/mpegvideo.c	Mon Apr 22 21:02:18 2002 +0000
@@ -645,6 +645,7 @@
         s->coded_order[j]= s->coded_order[j+1];
     }
     s->coded_order[j].picture[0]= s->coded_order[j].picture[1]= s->coded_order[j].picture[2]= NULL; //catch uninitalized buffers
+    s->coded_order[j].pict_type=0;
 
     switch(s->input_pict_type){
     default: