You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
h264: handle frame recovery in h264_field_start()
This is a more appropriate place for this. H264Context.recovery_frame is shared between frame threads, so modifying it where it is right now is invalid.
This commit is contained in:
@@ -1335,6 +1335,24 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
|
|||||||
|
|
||||||
h->picture_idr = nal->type == H264_NAL_IDR_SLICE;
|
h->picture_idr = nal->type == H264_NAL_IDR_SLICE;
|
||||||
|
|
||||||
|
if (h->sei.recovery_point.recovery_frame_cnt >= 0 && h->recovery_frame < 0) {
|
||||||
|
h->recovery_frame = (h->poc.frame_num + h->sei.recovery_point.recovery_frame_cnt) &
|
||||||
|
((1 << h->ps.sps->log2_max_frame_num) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE) ||
|
||||||
|
(h->sei.recovery_point.recovery_frame_cnt >= 0);
|
||||||
|
|
||||||
|
if (nal->type == H264_NAL_IDR_SLICE || h->recovery_frame == h->poc.frame_num) {
|
||||||
|
h->recovery_frame = -1;
|
||||||
|
h->cur_pic_ptr->recovered = 1;
|
||||||
|
}
|
||||||
|
// If we have an IDR, all frames after it in decoded order are
|
||||||
|
// "recovered".
|
||||||
|
if (nal->type == H264_NAL_IDR_SLICE)
|
||||||
|
h->frame_recovered |= FRAME_RECOVERED_IDR;
|
||||||
|
h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
|
||||||
|
|
||||||
/* Set the frame properties/side data. Only done for the second field in
|
/* Set the frame properties/side data. Only done for the second field in
|
||||||
* field coded frames, since some SEI information is present for each field
|
* field coded frames, since some SEI information is present for each field
|
||||||
* and is merged by the SEI parsing code. */
|
* and is merged by the SEI parsing code. */
|
||||||
|
@@ -704,24 +704,6 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
|
|||||||
if (sl->redundant_pic_count > 0)
|
if (sl->redundant_pic_count > 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (h->sei.recovery_point.recovery_frame_cnt >= 0 && h->recovery_frame < 0) {
|
|
||||||
h->recovery_frame = (h->poc.frame_num + h->sei.recovery_point.recovery_frame_cnt) &
|
|
||||||
((1 << h->ps.sps->log2_max_frame_num) - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
h->cur_pic_ptr->f->key_frame |=
|
|
||||||
(nal->type == H264_NAL_IDR_SLICE) || (h->sei.recovery_point.recovery_frame_cnt >= 0);
|
|
||||||
|
|
||||||
if (nal->type == H264_NAL_IDR_SLICE || h->recovery_frame == h->poc.frame_num) {
|
|
||||||
h->recovery_frame = -1;
|
|
||||||
h->cur_pic_ptr->recovered = 1;
|
|
||||||
}
|
|
||||||
// If we have an IDR, all frames after it in decoded order are
|
|
||||||
// "recovered".
|
|
||||||
if (nal->type == H264_NAL_IDR_SLICE)
|
|
||||||
h->frame_recovered |= FRAME_RECOVERED_IDR;
|
|
||||||
h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
|
|
||||||
|
|
||||||
if (h->current_slice == 1) {
|
if (h->current_slice == 1) {
|
||||||
if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS))
|
if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS))
|
||||||
decode_postinit(h, i >= nals_needed);
|
decode_postinit(h, i >= nals_needed);
|
||||||
|
Reference in New Issue
Block a user