diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2017-04-05 16:18:54 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2017-04-06 10:03:28 -0400 |
commit | 9a54c6f243412f62bae498ddcac337cb18ae6290 (patch) | |
tree | 51466a5c55cbd9706db19aac1546644be3ac4ae8 /libavcodec/vp8.h | |
parent | 83ae7e6350cf12ce64b184fb717011551cc02d62 (diff) | |
download | ffmpeg-9a54c6f243412f62bae498ddcac337cb18ae6290.tar.gz |
vp8: make wait/thread_mb_pos atomic.
Fixes tsan warnings like this in fate-vp8-test-vector-007:
WARNING: ThreadSanitizer: data race (pid=3590)
Write of size 4 at 0x7d8c0000e07c by thread T2:
#0 decode_mb_row_no_filter src/libavcodec/vp8.c:2330 (ffmpeg+0x000000ffb59e)
[..]
Previous write of size 4 at 0x7d8c0000e07c by thread T1:
#0 decode_mb_row_no_filter src/libavcodec/vp8.c:2330 (ffmpeg+0x000000ffb59e)
Diffstat (limited to 'libavcodec/vp8.h')
-rw-r--r-- | libavcodec/vp8.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/vp8.h b/libavcodec/vp8.h index 3910b5c0dd..d7e7680276 100644 --- a/libavcodec/vp8.h +++ b/libavcodec/vp8.h @@ -26,6 +26,8 @@ #ifndef AVCODEC_VP8_H #define AVCODEC_VP8_H +#include <stdatomic.h> + #include "libavutil/buffer.h" #include "libavutil/thread.h" @@ -114,8 +116,8 @@ typedef struct VP8ThreadData { pthread_mutex_t lock; pthread_cond_t cond; #endif - int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF) - int wait_mb_pos; // What the current thread is waiting on. + atomic_int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF) + atomic_int wait_mb_pos; // What the current thread is waiting on. #define EDGE_EMU_LINESIZE 32 DECLARE_ALIGNED(16, uint8_t, edge_emu_buffer)[21 * EDGE_EMU_LINESIZE]; |