From 98f89d615b6490a5b93930c7bfa74c427dedf04e Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 7 Nov 2016 14:21:18 +0100 Subject: [PATCH] pthread_frame: properly propagate the hw frame context across frame threads Merges Libav commit 84f22568. Signed-off-by: wm4 --- libavcodec/pthread_frame.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c index 2a5dfc6723..18f89ee73d 100644 --- a/libavcodec/pthread_frame.c +++ b/libavcodec/pthread_frame.c @@ -235,6 +235,17 @@ FF_ENABLE_DEPRECATION_WARNINGS dst->sample_fmt = src->sample_fmt; dst->channel_layout = src->channel_layout; dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data; + + if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx || + (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) { + av_buffer_unref(&dst->hw_frames_ctx); + + if (src->hw_frames_ctx) { + dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx); + if (!dst->hw_frames_ctx) + return AVERROR(ENOMEM); + } + } } if (for_user) {