From f800d6508d7e8fbd8d9777b775d333a4f02112ef Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 28 Mar 2017 19:37:42 -0400 Subject: [PATCH] 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. --- libavcodec/dnxhddec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index f67763ef47..383e64ca9e 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;