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/vaapi_mpeg2.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libavcodec/vaapi_mpeg2.c') diff --git a/libavcodec/vaapi_mpeg2.c b/libavcodec/vaapi_mpeg2.c index b2417ee830..0d197c9692 100644 --- a/libavcodec/vaapi_mpeg2.c +++ b/libavcodec/vaapi_mpeg2.c @@ -20,6 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "hwaccel.h" #include "mpegutils.h" #include "mpegvideo.h" #include "internal.h" @@ -183,4 +184,5 @@ AVHWAccel ff_mpeg2_vaapi_hwaccel = { .init = &ff_vaapi_decode_init, .uninit = &ff_vaapi_decode_uninit, .priv_data_size = sizeof(VAAPIDecodeContext), + .caps_internal = HWACCEL_CAP_ASYNC_SAFE, }; -- cgit v1.2.3