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

Steve Lhomme git at videolan.org
Thu Aug 2 13:08:07 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon Feb 26 12:17:26 2018 +0100| [6fc9c9f63eeb5ff4c86dbcf8e44209f283f93007] | committer: Steve Lhomme

hw:d3d11: fix crash in D3D11_NV12

The source may not always come from a decoder

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6fc9c9f63eeb5ff4c86dbcf8e44209f283f93007
---

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

diff --git a/modules/hw/d3d11/d3d11_surface.c b/modules/hw/d3d11/d3d11_surface.c
index 5d34ffa792..1d00ebcf3a 100644
--- a/modules/hw/d3d11/d3d11_surface.c
+++ b/modules/hw/d3d11/d3d11_surface.c
@@ -376,17 +376,21 @@ 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->d3d_proc.procEnumerator)
     {
         HRESULT hr;
-        assert(p_sys->slice_index == viewDesc.Texture2D.ArraySlice);
         if (FAILED( D3D11_Assert_ProcessorInput(p_filter, &sys->d3d_proc, p_sys) ))
             return;
 



More information about the vlc-commits mailing list