summaryrefslogtreecommitdiff
path: root/libavcodec/thread.h
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2017-04-03 10:24:05 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2017-04-06 10:03:27 -0400
commit083300bea935d125b83f60d7030f78a7ffb0f3df (patch)
treef88f654f5fb7d0e02d6b661e163890280e98a17b /libavcodec/thread.h
parentac24a8202a6fdfb469af1fa68d537fb2f8d1ba6a (diff)
pthread_frame: allow per-field ThreadFrame owners.
This tries to handle cases where separate invocations of decode_frame() (each running in separate threads) write to respective fields in the same AVFrame->data[]. Having per-field owners makes interaction between readers (the referencing thread) and writers (the decoding thread) slightly more optimal if both accesses are field-based, since they will use the respective producer's thread objects (mutex/cond) instead of sharing the thread objects of the first field's producer. In practice, this fixes the following tsan-warning in fate-h264: WARNING: ThreadSanitizer: data race (pid=21615) Read of size 4 at 0x7d640000d9fc by thread T2 (mutexes: write M1006): #0 ff_thread_report_progress pthread_frame.c:569 (ffmpeg:x86_64+0x100f7cf54) [..] Previous write of size 4 at 0x7d640000d9fc by main thread (mutexes: write M1004): #0 update_context_from_user pthread_frame.c:335 (ffmpeg:x86_64+0x100f81abb)
Diffstat (limited to 'libavcodec/thread.h')
-rw-r--r--libavcodec/thread.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/thread.h b/libavcodec/thread.h
index c848d7ae8b..90864b59d9 100644
--- a/libavcodec/thread.h
+++ b/libavcodec/thread.h
@@ -34,7 +34,7 @@
typedef struct ThreadFrame {
AVFrame *f;
- AVCodecContext *owner;
+ AVCodecContext *owner[2];
// progress->data is an array of 2 ints holding progress for top/bottom
// fields
AVBufferRef *progress;