[FFmpeg-cvslog] pthread_frame: properly propagate the hw frame context across frame threads

Anton Khirnov git at videolan.org
Fri Mar 31 20:47:59 EEST 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Nov  7 14:21:18 2016 +0100| [84f225684cd389747907381122c073aa1c8b6bf1] | committer: Anton Khirnov

pthread_frame: properly propagate the hw frame context across frame threads

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84f225684cd389747907381122c073aa1c8b6bf1
---

 libavcodec/pthread_frame.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 210ee69..671c551 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -223,6 +223,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
         dst->hwaccel = src->hwaccel;
         dst->hwaccel_context = src->hwaccel_context;
         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) {



More information about the ffmpeg-cvslog mailing list