[FFmpeg-devel] [PATCH] d3d11va: use the proper slice index

Steve Lhomme robux4 at videolabs.io
Tue Oct 4 17:47:12 EEST 2016


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.
---
 libavcodec/dxva2.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index f68df86..f8801c9 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -43,7 +43,16 @@ unsigned ff_dxva2_get_surface_index(const AVCodecContext *avctx,
 
     for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++)
         if (DXVA_CONTEXT_SURFACE(avctx, ctx, i) == surface)
+#if CONFIG_D3D11VA
+        {
+            ID3D11VideoDecoderOutputView *pOut = DXVA_CONTEXT_SURFACE(avctx, ctx, i);
+            D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+            ID3D11VideoDecoderOutputView_GetDesc( pOut, &viewDesc );
+            return viewDesc.Texture2D.ArraySlice;
+        }
+#elif CONFIG_DXVA2
             return i;
+#endif
 
     assert(0);
     return 0;
-- 
2.8.2



More information about the ffmpeg-devel mailing list