From 4413e950b26396bfb797168e4f81164a022cc6f3 Mon Sep 17 00:00:00 2001 From: Derek Buitenhuis Date: Wed, 7 Dec 2016 17:57:41 +0000 Subject: [PATCH] h264_slice: Wait for refs to be available before we use them in error concealment This could happen when there was a frame number gap and frame threading was used. This fixes #5458. Debugging-by: Ronald S. Bultje Debugging-by: Justin Ruggles Signed-off-by: Derek Buitenhuis --- libavcodec/h264_slice.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 1f2c06521e..9a334a97cb 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1424,6 +1424,9 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, h->short_ref[0]->f->width == prev->f->width && h->short_ref[0]->f->height == prev->f->height && h->short_ref[0]->f->format == prev->f->format) { + ff_thread_await_progress(&prev->tf, INT_MAX, 0); + if (prev->field_picture) + ff_thread_await_progress(&prev->tf, INT_MAX, 1); av_image_copy(h->short_ref[0]->f->data, h->short_ref[0]->f->linesize, (const uint8_t **)prev->f->data,