[vlc-commits] d3d11va: only use the module if the decoder device matches

Steve Lhomme git at videolan.org
Fri Oct 25 10:57:51 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jul 11 09:44:40 2019 +0200| [9154d195797dbdd1cd5ec6fe6643c8e857cfe08a] | committer: Steve Lhomme

d3d11va: only use the module if the decoder device matches

In the future we may allow decoding on the same adapter but create a new
IDirect3D11Device with decoding capabilities if that's not the case. It may
not work anyway.

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

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

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 34b53c35ff..7a6f762fe9 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -295,12 +295,11 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
                 D3D11_ReleaseDevice(&sys->d3d_dev);
                 vlc_video_context_Release( sys->vctx );
                 sys->vctx = NULL;
-            } else {
-                sys->hw.video_context = d3dvidctx;
-                d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
-                priv->device = sys->d3d_dev.d3dcontext;
-                ID3D11DeviceContext_Release(priv->device);
+                /* TODO we can try all adapters to see if there's one that can decode */
+                goto error;
             }
+
+            sys->hw.video_context = d3dvidctx;
         }
     }
 
@@ -311,6 +310,10 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *des
         goto error;
     }
 
+    d3d11_video_context_t *priv = GetD3D11ContextPrivate(sys->vctx);
+    priv->device = sys->d3d_dev.d3dcontext;
+    ID3D11DeviceContext_Release(priv->device);
+
     struct va_pool_cfg pool_cfg = {
         D3dCreateDevice,
         DxDestroySurfaces,



More information about the vlc-commits mailing list