pthread_frame: do not run hwaccel decoding asynchronously unless it's safe

Multimedia / FFmpeg - Anton Khirnov [khirnov.net] - 21 March 2017 01:17 EDT

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.

e0cd598 pthread_frame: do not run hwaccel decoding asynchronously unless it's safe
libavcodec/avcodec.h | 5 +++++
libavcodec/hwaccel.h | 24 +++++++++++++++++++++
libavcodec/pthread_frame.c | 54 ++++++++++++++++++++++++++++++++++++++++------
libavcodec/vaapi_h264.c | 2 ++
libavcodec/vaapi_mpeg2.c | 2 ++
libavcodec/vaapi_mpeg4.c | 3 +++
libavcodec/vaapi_vc1.c | 3 +++
libavcodec/vdpau_h264.c | 2 ++
libavcodec/vdpau_hevc.c | 2 ++
libavcodec/vdpau_mpeg12.c | 3 +++
libavcodec/vdpau_mpeg4.c | 2 ++
libavcodec/vdpau_vc1.c | 3 +++
12 files changed, 98 insertions(+), 7 deletions(-)

  • Share