h264_slice: Wait for refs to be available before we use them in error concealment

Message ID 20161214094235.3E2CA5DACB@aruru.libav.org
State New
Headers show

Commit Message

Janne Grunau Dec. 14, 2016, 9:42 a.m.
Module: libav
Branch: master
Commit: 5c7f2cf81df06614f255f061850132355a01d75e

Author:    Derek Buitenhuis <derek.buitenhuis@gmail.com>
Committer: Anton Khirnov <anton@khirnov.net>
Date:      Mon Dec 12 14:33:27 2016 +0000

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.

Debugging-by: Ronald S. Bultje <rsbultje@gmail.com>
Debugging-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

CC:libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>

---

 libavcodec/h264_slice.c |    3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 8d79740..1b91088 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1404,6 +1404,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,