pthread_frame: do not run hwaccel decoding asynchronously unless it's safe
authorAnton Khirnov <anton@khirnov.net>
Thu, 24 Nov 2016 14:14:22 +0000 (15:14 +0100)
committerwm4 <nfxjfg@googlemail.com>
Tue, 21 Mar 2017 05:17:28 +0000 (06:17 +0100)
commite0cd598bc4684654d63942e9ff4872c0b48a7dc2
tree4d342847caf85a15ef39d57508bcd458e1da02ff
parent14bb15bfd56d6e907fabe4620206c1ee152b7a20
pthread_frame: do not run hwaccel decoding asynchronously unless it's safe

Certain hardware decoding APIs are not guaranteed to be thread-safe, so
having the user access decoded hardware surfaces while the decoder is
running in another thread can cause failures (this is mainly known to
happen with DXVA2).

For such hwaccels, only allow the decoding thread to run while the user
is inside a lavc decode call (avcodec_send_packet/receive_frame).

Merges Libav commit d4a91e65.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
Tested-by: Michael Niedermayer <michael@niedermayer.cc>
12 files changed:
libavcodec/avcodec.h
libavcodec/hwaccel.h [new file with mode: 0644]
libavcodec/pthread_frame.c
libavcodec/vaapi_h264.c
libavcodec/vaapi_mpeg2.c
libavcodec/vaapi_mpeg4.c
libavcodec/vaapi_vc1.c
libavcodec/vdpau_h264.c
libavcodec/vdpau_hevc.c
libavcodec/vdpau_mpeg12.c
libavcodec/vdpau_mpeg4.c
libavcodec/vdpau_vc1.c