[FFmpeg-cvslog] dnxhd: initialize DNXHDContext::avctx to each thread's respective one.

Ronald S. Bultje git at videolan.org
Fri Mar 31 15:26:47 EEST 2017


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Tue Mar 28 19:37:42 2017 -0400| [f800d6508d7e8fbd8d9777b775d333a4f02112ef] | committer: Ronald S. Bultje

dnxhd: initialize DNXHDContext::avctx to each thread's respective one.

Otherwise all thread's private contexts have the avctx pointer set to
the AVCodecContext of the first thread, which means all writes to
ctx->avctx->* (in e.g. read_header) are effectively race conditions.

Fixes fate-dnxhd under tsan.

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

 libavcodec/dnxhddec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index f67763e..383e64c 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -145,6 +145,7 @@ static av_cold int dnxhd_decode_init_thread_copy(AVCodecContext *avctx)
 {
     DNXHDContext *ctx = avctx->priv_data;
 
+    ctx->avctx = avctx;
     // make sure VLC tables will be loaded when cid is parsed
     ctx->cid = -1;
 



More information about the ffmpeg-cvslog mailing list