Permalink
Browse files

Don't fill in frame gaps with copied refs after flush

The filled in refs cause corruptions in the video frame
for a long time after it should have recovered.
  • Loading branch information...
1 parent 91a10f6 commit 46d99a89aa16db1981441bf7103a30e7d28e5e26 @elupus elupus committed with elupus Nov 18, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/ffmpeg/libavcodec/h264.c
View
4 lib/ffmpeg/libavcodec/h264.c
@@ -1464,7 +1464,7 @@ static void implicit_weight_table(H264Context *h, int field){
*/
static void idr(H264Context *h){
ff_h264_remove_all_refs(h);
- h->prev_frame_num= 0;
+ h->prev_frame_num= -1;
h->prev_frame_num_offset= 0;
h->prev_poc_msb=
h->prev_poc_lsb= 0;
@@ -1892,7 +1892,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
h->mb_field_decoding_flag= s->picture_structure != PICT_FRAME;
if(h0->current_slice == 0){
- while(h->frame_num != h->prev_frame_num &&
+ while(h->frame_num != h->prev_frame_num && h->prev_frame_num >= 0 &&
h->frame_num != (h->prev_frame_num+1)%(1<<h->sps.log2_max_frame_num)){
Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL;
av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num);

0 comments on commit 46d99a8

Please sign in to comment.