changeset 3125:16f9d33c027d libavcodec

fix some crashes when missing frames
author lorenm
date Mon, 13 Feb 2006 18:13:13 +0000
parents 00b0af60fe53
children 05a10f97d510
files h264.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/h264.c	Mon Feb 13 12:53:25 2006 +0000
+++ b/h264.c	Mon Feb 13 18:13:13 2006 +0000
@@ -1202,7 +1202,7 @@
     for(list=0; list<2; list++){
         for(i=0; i<ref1->ref_count[list]; i++){
             const int poc = ref1->ref_poc[list][i];
-            h->map_col_to_list0[list][i] = PART_NOT_AVAILABLE;
+            h->map_col_to_list0[list][i] = 0; /* bogus; fills in for missing frames */
             for(j=0; j<h->ref_count[list]; j++)
                 if(h->ref_list[list][j].poc == poc){
                     h->map_col_to_list0[list][i] = j;
@@ -2607,7 +2607,8 @@
     const int pic_width  = 16*s->mb_width;
     const int pic_height = 16*s->mb_height;
 
-    assert(pic->data[0]);
+    if(!pic->data[0])
+        return;
 
     if(mx&7) extra_width -= 3;
     if(my&7) extra_height -= 3;
@@ -7774,7 +7775,9 @@
             }
 
         out_of_order = !cross_idr && prev && out->poc < prev->poc;
-        if(prev && pics <= s->avctx->has_b_frames)
+        if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames)
+            { }
+        else if(prev && pics <= s->avctx->has_b_frames)
             out = prev;
         else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15)
            || (s->low_delay &&