[vlc-commits] d3d11va: do not use the external if there's not enough pictures

Steve Lhomme git at videolan.org
Sat Feb 24 15:27:06 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Sat Feb 24 13:46:53 2018 +0100| [b6095a8abbb2205939c829dc2ecb842ee9d16e6e] | committer: Steve Lhomme

d3d11va: do not use the external if there's not enough pictures

Do the detection earlier and avoid fetching pictures from the pool for nothing.

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

 modules/codec/avcodec/d3d11va.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 539abc824b..0b88530f5c 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -712,6 +712,12 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
         sys->textureWidth  = fmt->i_width;
         sys->textureHeight = fmt->i_height;
     }
+    if (sys->totalTextureSlices && sys->totalTextureSlices < surface_count)
+    {
+        msg_Warn(va, "not enough decoding slices in the texture (%d/%d)",
+                 sys->totalTextureSlices, surface_count);
+        dx_sys->can_extern_pool = false;
+    }
 #if VLC_WINSTORE_APP
     /* On the Xbox 1/S, any decoding of H264 with one dimension over 2304
      * crashes totally the device */
@@ -763,13 +769,6 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
 
             D3D11_TEXTURE2D_DESC texDesc;
             ID3D11Texture2D_GetDesc(pic->p_sys->texture[KNOWN_DXGI_INDEX], &texDesc);
-            if (unlikely(texDesc.ArraySize < surface_count))
-            {
-                msg_Warn(va, "not enough decoding slices in the texture (%d/%d)",
-                         texDesc.ArraySize, surface_count);
-                dx_sys->can_extern_pool = false;
-                break;
-            }
             assert(texDesc.Format == sys->render);
             assert(texDesc.BindFlags & D3D11_BIND_DECODER);
 



More information about the vlc-commits mailing list