[vlc-commits] dxva2: let the decoder handle the device referencing

Steve Lhomme git at videolan.org
Thu May 28 17:32:09 CEST 2015


vlc | branch: master | Steve Lhomme <robux4 at gmail.com> | Thu May 28 16:27:44 2015 +0200| [3071e1858a3027608896f026c10d07dc798fae71] | committer: Jean-Baptiste Kempf

dxva2: let the decoder handle the device referencing

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/avcodec/directx_va.c |   14 +++++---------
 modules/codec/avcodec/dxva2.c      |    6 ++++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 327b5cc..45644e6 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -423,16 +423,12 @@ int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys,
     }
     msg_Dbg(va, "DLLs loaded");
 
-    if (dx_sys->d3ddev) {
-        msg_Dbg(va, "Reusing DirectX device");
-    } else {
-        /* */
-        if (dx_sys->pf_create_device(va)) {
-            msg_Err(va, "Failed to create DirectX device");
-            goto error;
-        }
-        msg_Dbg(va, "CreateDevice succeed");
+    /* */
+    if (dx_sys->pf_create_device(va)) {
+        msg_Err(va, "Failed to create DirectX device");
+        goto error;
     }
+    msg_Dbg(va, "CreateDevice succeed");
 
     if (dx_sys->pf_create_device_manager(va)) {
         msg_Err(va, "D3dCreateDeviceManager failed");
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 7ab4c9d..9b002c3 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -315,6 +315,12 @@ static int D3dCreateDevice(vlc_va_t *va)
 {
     vlc_va_sys_t *sys = va->sys;
 
+    if (sys->dx_sys.d3ddev) {
+        msg_Dbg(va, "Reusing Direct3D9 device");
+        IDirect3DDevice9_AddRef(sys->dx_sys.d3ddev);
+        return VLC_SUCCESS;
+    }
+
     /* */
     LPDIRECT3D9 (WINAPI *Create9)(UINT SDKVersion);
     Create9 = (void *)GetProcAddress(sys->hd3d9_dll, "Direct3DCreate9");



More information about the vlc-commits mailing list