Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@videolabs.io>2016-10-05 13:52:00 +0300
committerDiego Biurrun <diego@biurrun.de>2016-10-05 19:37:27 +0300
commitbe630b1e08ebe8f766b1798accd6b8e5e096f5aa (patch)
tree045e5f03cb566d421f672455b7a82a3afc113522 /libavcodec/dxva2.c
parent715f139c9bd407ef7f4d1f564ad683140ec61e6d (diff)
d3d11va: Use the proper decoding slice index
The decoding buffer index expected by D3D11VA is the one from the ID3D11Texture2D not the one from the ID3D11VideoDecoderOutputView array in AVD3D11VAContext. Otherwise, when providing decoder slices that do not start from 0, pictures appear in bogus order. For an invalid index crashes and image corruption can occur. Signed-off-by: Diego Biurrun <diego@biurrun.de>
Diffstat (limited to 'libavcodec/dxva2.c')
-rw-r--r--libavcodec/dxva2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index 91570941c3..eeac474eae 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -42,8 +42,17 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
unsigned i;
for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++)
- if (DXVA_CONTEXT_SURFACE(avctx, ctx, i) == surface)
+#if CONFIG_D3D11VA
+ if (avctx->pix_fmt == AV_PIX_FMT_D3D11VA_VLD && ctx->d3d11va.surface[i] == surface) {
+ D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+ ID3D11VideoDecoderOutputView_GetDesc(ctx->d3d11va.surface[i], &viewDesc);
+ return viewDesc.Texture2D.ArraySlice;
+ }
+#endif
+#if CONFIG_DXVA2
+ if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface)
return i;
+#endif
assert(0);
return 0;