diff options
author | Steve Lhomme <robux4@videolabs.io> | 2016-06-15 09:24:29 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-06-17 08:39:41 +0200 |
commit | 193a42199487b075bb452453ee034a1190a648b1 (patch) | |
tree | d71a4ed2f57a9f006abecff7b0dd4178def53b22 | |
parent | 8b069b1cd516bca60aeec612ab1d47e1d77ffb68 (diff) | |
download | ffmpeg-193a42199487b075bb452453ee034a1190a648b1.tar.gz |
d3d11va: don't keep the context lock while waiting for a frame
also fixes a deadlock found by Денис Кулаков <kudesnik33ra@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/dxva2.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index 2cf57ad653..f68df860dc 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -158,9 +158,15 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame, ff_dxva2_get_surface(frame), NULL); #endif - if (hr == E_PENDING) - av_usleep(2000); - } while (hr == E_PENDING && ++runs < 50); + if (hr != E_PENDING || ++runs > 50) + break; +#if CONFIG_D3D11VA + if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) + if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE) + ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex); +#endif + av_usleep(2000); + } while(1); if (FAILED(hr)) { av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr); |