]> git.sesse.net Git - ffmpeg/commitdiff
pthread_frame: properly propagate the hw frame context across frame threads
authorAnton Khirnov <anton@khirnov.net>
Mon, 7 Nov 2016 13:21:18 +0000 (14:21 +0100)
committerwm4 <nfxjfg@googlemail.com>
Tue, 21 Mar 2017 05:16:49 +0000 (06:16 +0100)
Merges Libav commit 84f22568.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
libavcodec/pthread_frame.c

index 2a5dfc67236b933b3d20d89edd7b8ad8d295d4a1..18f89ee73de805d0045842db4865372d97a2875d 100644 (file)
@@ -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) {