[FFmpeg-devel] [PATCH 2/2] dnxhd: initialize DNXHDContext::avctx to each thread's respective one.

Ronald S. Bultje rsbultje at gmail.com
Wed Mar 29 02:37:55 EEST 2017


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.
---
 libavcodec/dnxhddec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index 305fd52..766467e 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;
 
-- 
2.8.1



More information about the ffmpeg-devel mailing list