From e0cd598bc4684654d63942e9ff4872c0b48a7dc2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 24 Nov 2016 15:14:22 +0100 Subject: 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 Tested-by: Michael Niedermayer --- libavcodec/vdpau_mpeg12.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libavcodec/vdpau_mpeg12.c') diff --git a/libavcodec/vdpau_mpeg12.c b/libavcodec/vdpau_mpeg12.c index 3ac2cb827d..b657007ee7 100644 --- a/libavcodec/vdpau_mpeg12.c +++ b/libavcodec/vdpau_mpeg12.c @@ -24,6 +24,7 @@ #include #include "avcodec.h" +#include "hwaccel.h" #include "mpegvideo.h" #include "vdpau.h" #include "vdpau_internal.h" @@ -114,6 +115,7 @@ AVHWAccel ff_mpeg1_vdpau_hwaccel = { .init = vdpau_mpeg1_init, .uninit = ff_vdpau_common_uninit, .priv_data_size = sizeof(VDPAUContext), + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, }; #endif @@ -148,5 +150,6 @@ AVHWAccel ff_mpeg2_vdpau_hwaccel = { .init = vdpau_mpeg2_init, .uninit = ff_vdpau_common_uninit, .priv_data_size = sizeof(VDPAUContext), + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, }; #endif -- cgit v1.2.3