[FFmpeg-devel] dxva2 patch
Денис Кулаков
kudesnik33ra at gmail.com
Wed Jun 8 08:57:51 CEST 2016
In dxva2 code there is bug with context_mutex usage -
if ID3D11VideoContext_DecoderBeginFrame return E_PENDING -
WaitForSingleObjectEx(context_mutex) will be called again, but each call to
it must have corresponding ReleaseMutex, otherwise it will not be released
- so after E_PENDING context mutex will never be released.
-------------- next part --------------
--- dxva2.c
+++ dxva2fix.c
@@ -142,11 +142,16 @@
HRESULT hr;
unsigned type;
- do {
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
WaitForSingleObjectEx(D3D11VA_CONTEXT(ctx)->context_mutex, INFINITE, FALSE);
+ }
+#endif
+
+ do {
+#if CONFIG_D3D11VA
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
0, NULL);
More information about the ffmpeg-devel
mailing list