]> granicus.if.org Git - libvpx/commit
Add atomics to vp8 synchronization primitives.
authorPeter Boström <pbos@google.com>
Fri, 25 Aug 2017 22:48:11 +0000 (15:48 -0700)
committerPeter Boström <pbos@google.com>
Fri, 1 Sep 2017 00:55:57 +0000 (17:55 -0700)
commitd42e876164c63eead9d0db6f53cda866f508cd4a
tree63297238ef8c9f5e4321d41f2b42748daf072810
parent2d0c11093e9854980a84d9415da2eb6a4cd42647
Add atomics to vp8 synchronization primitives.

Fixes issue on iPad Pro 10.5 (and probably other places) where threads
are not properly synchronized. On x86 this data race was benign as load
and store instructions are atomic, they were being atomic in practice as
the program hasn't been observed to be miscompiled.

Such guarantees are not made outside x86, and real problems manifested
where libvpx reliably reproduced a broken bitstream for even just the
initial keyframe. This was detected in WebRTC where this device started
using multithreading (as its CPU count is higher than earlier devices,
where the problem did not manifest as single-threading was used in
practice).

This issue was not detected under thread-sanitizer bots as mutexes were
conditionally used under this platform to simulate the protected read
and write semantics that were in practice provided on x86 platforms.

This change also removes several mutexes, so encoder/decoder state is
lighter-weight after this change and we do not need to initialize so
many mutexes (this was done even on non-thread-sanitizer platforms where
they were unused).

Change-Id: If41fcb0d99944f7bbc8ec40877cdc34d672ae72a
12 files changed:
vp8/common/threading.h
vp8/decoder/decodeframe.c
vp8/decoder/onyxd_int.h
vp8/decoder/threading.c
vp8/encoder/bitstream.c
vp8/encoder/encodeframe.c
vp8/encoder/ethreading.c
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/vp8_dx_iface.c
vpx_util/vpx_atomics.h [new file with mode: 0644]
vpx_util/vpx_util.mk