[FFmpeg-cvslog] huffyuv: assign correct per-thread avctx pointer to HYuvContext::avctx.

Ronald S. Bultje git at videolan.org
Thu Apr 13 03:31:38 EEST 2017


ffmpeg | branch: release/3.3 | Ronald S. Bultje <rsbultje at gmail.com> | Mon Apr  3 22:28:22 2017 -0400| [5e84c94f6962e23b552809280bd89c70d4a7ef5e] | committer: Michael Niedermayer

huffyuv: assign correct per-thread avctx pointer to HYuvContext::avctx.

Fixes the following tsan warning when running fate-vsynth_lena-ffvhuff:

WARNING: ThreadSanitizer: data race (pid=6484)
  Write of size 8 at 0x7d64000154b8 by main thread (mutexes: write M1331):
    #0 update_context_from_user src/libavcodec/pthread_frame.c:331 (ffmpeg+0x000000dca887)
[..]
  Previous read of size 8 at 0x7d64000154b8 by thread T2 (mutexes: write M1334):
    #0 draw_slice src/libavcodec/huffyuvdec.c:857 (ffmpeg+0x000000bcc86f)

(cherry picked from commit 7c7e7c44a6eb68eca861e45cb2ce78f582b12c69)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/huffyuvdec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c
index 5572b9819f..979c4b9d5c 100644
--- a/libavcodec/huffyuvdec.c
+++ b/libavcodec/huffyuvdec.c
@@ -579,6 +579,8 @@ static av_cold int decode_init_thread_copy(AVCodecContext *avctx)
     HYuvContext *s = avctx->priv_data;
     int i, ret;
 
+    s->avctx = avctx;
+
     if ((ret = ff_huffyuv_alloc_temp(s)) < 0) {
         ff_huffyuv_common_end(s);
         return ret;



More information about the ffmpeg-cvslog mailing list