1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avcodec/h264_slice: clear the ER picture when starting a second field

h264_frame_start() clears h->er.cur_pic, and decode_nal_units() only sets
it again for pictures that are not field coded, right before running error
concealment. A second field goes through neither, so h->er.cur_pic keeps
pointing at whatever frame coded picture the context decoded earlier.

With frame threading the two fields of a pair are decoded by different
contexts, so whether this triggers depends on what the context that picks
up the second field decoded before, which is why the number of bogus
warnings varies between runs.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
(cherry picked from commit f1d318e5eb2eb487d2be4b4b721b93ae76fd5ba7)
This commit is contained in:
Kacper Michajłow
2026-07-30 17:29:04 +02:00
committed by ffmpeg-devel
parent 7c533d0f86
commit baa0340713

View File

@@ -1621,6 +1621,10 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
int field = h->picture_structure == PICT_BOTTOM_FIELD;
release_unused_pictures(h, 0);
h->cur_pic_ptr->tf.owner[field] = h->avctx;
/* h264_frame_start(), which clears this for every other picture, is
* not called for a second field. */
if (CONFIG_ERROR_RESILIENCE)
ff_h264_set_erpic(&h->er.cur_pic, NULL);
}
/* Some macroblocks can be accessed before they're available in case
* of lost slices, MBAFF or threading. */