Mercurial > libavcodec.hg
comparison h264.c @ 3125:16f9d33c027d libavcodec
fix some crashes when missing frames
author | lorenm |
---|---|
date | Mon, 13 Feb 2006 18:13:13 +0000 |
parents | 2d35fb3cb940 |
children | 05a10f97d510 |
comparison
equal
deleted
inserted
replaced
3124:00b0af60fe53 | 3125:16f9d33c027d |
---|---|
1200 if(cur->pict_type != B_TYPE || h->direct_spatial_mv_pred) | 1200 if(cur->pict_type != B_TYPE || h->direct_spatial_mv_pred) |
1201 return; | 1201 return; |
1202 for(list=0; list<2; list++){ | 1202 for(list=0; list<2; list++){ |
1203 for(i=0; i<ref1->ref_count[list]; i++){ | 1203 for(i=0; i<ref1->ref_count[list]; i++){ |
1204 const int poc = ref1->ref_poc[list][i]; | 1204 const int poc = ref1->ref_poc[list][i]; |
1205 h->map_col_to_list0[list][i] = PART_NOT_AVAILABLE; | 1205 h->map_col_to_list0[list][i] = 0; /* bogus; fills in for missing frames */ |
1206 for(j=0; j<h->ref_count[list]; j++) | 1206 for(j=0; j<h->ref_count[list]; j++) |
1207 if(h->ref_list[list][j].poc == poc){ | 1207 if(h->ref_list[list][j].poc == poc){ |
1208 h->map_col_to_list0[list][i] = j; | 1208 h->map_col_to_list0[list][i] = j; |
1209 break; | 1209 break; |
1210 } | 1210 } |
2605 const int full_mx= mx>>2; | 2605 const int full_mx= mx>>2; |
2606 const int full_my= my>>2; | 2606 const int full_my= my>>2; |
2607 const int pic_width = 16*s->mb_width; | 2607 const int pic_width = 16*s->mb_width; |
2608 const int pic_height = 16*s->mb_height; | 2608 const int pic_height = 16*s->mb_height; |
2609 | 2609 |
2610 assert(pic->data[0]); | 2610 if(!pic->data[0]) |
2611 return; | |
2611 | 2612 |
2612 if(mx&7) extra_width -= 3; | 2613 if(mx&7) extra_width -= 3; |
2613 if(my&7) extra_height -= 3; | 2614 if(my&7) extra_height -= 3; |
2614 | 2615 |
2615 if( full_mx < 0-extra_width | 2616 if( full_mx < 0-extra_width |
7772 out = h->delayed_pic[i]; | 7773 out = h->delayed_pic[i]; |
7773 out_idx = i; | 7774 out_idx = i; |
7774 } | 7775 } |
7775 | 7776 |
7776 out_of_order = !cross_idr && prev && out->poc < prev->poc; | 7777 out_of_order = !cross_idr && prev && out->poc < prev->poc; |
7777 if(prev && pics <= s->avctx->has_b_frames) | 7778 if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) |
7779 { } | |
7780 else if(prev && pics <= s->avctx->has_b_frames) | |
7778 out = prev; | 7781 out = prev; |
7779 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) | 7782 else if((out_of_order && pics-1 == s->avctx->has_b_frames && pics < 15) |
7780 || (s->low_delay && | 7783 || (s->low_delay && |
7781 ((!cross_idr && prev && out->poc > prev->poc + 2) | 7784 ((!cross_idr && prev && out->poc > prev->poc + 2) |
7782 || cur->pict_type == B_TYPE))) | 7785 || cur->pict_type == B_TYPE))) |