X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fh264_slice.c;h=90e05ed8f1021682bb985981177345d42c61b5c1;hb=91bb871376730a2394ed0ae1a3fd4295977002d3;hp=aad54845888d021ad062ce41fa77af42a1115910;hpb=7a10541109cc04ffddc15f0749139aab80f56ebf;p=ffmpeg diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index aad54845888..90e05ed8f10 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1571,6 +1571,12 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, * one except for reference purposes. */ h->first_field = 1; h->cur_pic_ptr = NULL; + } else if (h->cur_pic_ptr->reference & DELAYED_PIC_REF) { + /* This frame was already output, we cannot draw into it + * anymore. + */ + h->first_field = 1; + h->cur_pic_ptr = NULL; } else { /* Second field in complementary pair */ h->first_field = 0; @@ -1601,8 +1607,10 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); } - ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc, + ret = ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc, h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc); + if (ret < 0) + return ret; memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); h->nb_mmco = sl->nb_mmco;