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:15 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-10-10 17:05:14 +0300
commit9b462a0b9df6260f59726c98d8aef8b07a1e442b (patch)
treef4073baa8150bba93b2ac24fbdb0c9353482718b /libavcodec/dxva2.c
parent1bda0ee5305598f6658d3e49bdca2dd9f78a0ba4 (diff)
avcodec/d3d11va: use the proper slice index
The slice index expected by D3D11VA is the one from the texture not from the array or texture/slices. In VLC the slices we provide the decoder don't start from 0 and thus pictures appear in bogus order. With possible crashes and corruptions when using an invalid index. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/dxva2.c')
-rw-r--r--libavcodec/dxva2.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index f68df860dc..e168233402 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -42,8 +42,18 @@ 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;