summaryrefslogtreecommitdiffstats
path: root/libavcodec/dxva2.c
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@gmail.com>2015-09-16 13:27:42 +0200
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-09-17 10:33:21 +0200
commite3d4784eb31b3ea4a97f2d4c698a75fab9bf3d86 (patch)
tree55fc7a458eefd08ec3248463e868bc7ee030eec0 /libavcodec/dxva2.c
parent781a25e9c419dd66063597cc5d70e8919de60561 (diff)
downloadffmpeg-streaming-e3d4784eb31b3ea4a97f2d4c698a75fab9bf3d86.zip
ffmpeg-streaming-e3d4784eb31b3ea4a97f2d4c698a75fab9bf3d86.tar.gz
d3d11va: WindowsPhone requires a mutex around ID3D11VideoContext
Diffstat (limited to 'libavcodec/dxva2.c')
-rw-r--r--libavcodec/dxva2.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 6a7dd53..8b0e686 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -144,10 +144,13 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
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);
hr = ID3D11VideoContext_DecoderBeginFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder,
ff_dxva2_get_surface(frame),
0, NULL);
+ }
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
@@ -161,6 +164,11 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
if (FAILED(hr)) {
av_log(avctx, AV_LOG_ERROR, "Failed to begin frame: 0x%lx\n", hr);
+#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
return -1;
}
@@ -260,8 +268,11 @@ int ff_dxva2_common_end_frame(AVCodecContext *avctx, AVFrame *frame,
end:
#if CONFIG_D3D11VA
- if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD)
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD) {
hr = ID3D11VideoContext_DecoderEndFrame(D3D11VA_CONTEXT(ctx)->video_context, D3D11VA_CONTEXT(ctx)->decoder);
+ if (D3D11VA_CONTEXT(ctx)->context_mutex != INVALID_HANDLE_VALUE)
+ ReleaseMutex(D3D11VA_CONTEXT(ctx)->context_mutex);
+ }
#endif
#if CONFIG_DXVA2
if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD)
OpenPOWER on IntegriCloud