[vlc-commits] hw:d3d11: fix crash in D3D11_NV12

Steve Lhomme git at videolan.org
Tue Aug 7 09:12:45 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 26 12:17:26 2018 +0100| [6487a7f1712a0e604cee1f43d7b6c7c213b40c10] | committer: Steve Lhomme

hw:d3d11: fix crash in D3D11_NV12

The source may not always come from a decoder

(cherry picked from commit 6fc9c9f63eeb5ff4c86dbcf8e44209f283f93007)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=6487a7f1712a0e604cee1f43d7b6c7c213b40c10
---

 modules/hw/d3d11/d3d11_surface.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 62f33749fa..268ff3073d 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -435,11 +435,16 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
         return;
     }
 
-    D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
-    ID3D11VideoDecoderOutputView_GetDesc( p_sys->decoder, &viewDesc );
-
+    UINT srcSlice;
+    if (!p_sys->decoder)
+        srcSlice = p_sys->slice_index;
+    else
+    {
+        D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC viewDesc;
+        ID3D11VideoDecoderOutputView_GetDesc( p_sys->decoder, &viewDesc );
+        srcSlice = viewDesc.Texture2D.ArraySlice;
+    }
     ID3D11Resource *srcResource = p_sys->resource[KNOWN_DXGI_INDEX];
-    UINT srcSlice = viewDesc.Texture2D.ArraySlice;
 
 #if CAN_PROCESSOR
     if (sys->procEnumerator)
@@ -451,7 +456,7 @@ static void D3D11_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
                 .FourCC = 0,
                 .ViewDimension = D3D11_VPIV_DIMENSION_TEXTURE2D,
                 .Texture2D.MipSlice = 0,
-                .Texture2D.ArraySlice = viewDesc.Texture2D.ArraySlice,
+                .Texture2D.ArraySlice = srcSlice,
             };
 
             hr = ID3D11VideoDevice_CreateVideoProcessorInputView(sys->d3dviddev,



More information about the vlc-commits mailing list