[vlc-devel] [PATCH 02/17] directx_va: release the d3ddev in pf_destroy_device()

Steve Lhomme robux4 at videolabs.io
Tue Jun 20 17:45:34 CEST 2017


And make the release strongly typed
---
 modules/codec/avcodec/d3d11va.c    | 3 +++
 modules/codec/avcodec/directx_va.c | 2 --
 modules/codec/avcodec/dxva2.c      | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index e862ca03ad..0663a1c85a 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -529,10 +529,13 @@ static int D3dCreateDevice(vlc_va_t *va)
  */
 static void D3dDestroyDevice(vlc_va_t *va)
 {
+    directx_sys_t *dx_sys = &va->sys->dx_sys;
     if (va->sys->d3dvidctx)
         ID3D11VideoContext_Release(va->sys->d3dvidctx);
     if (va->sys->d3dctx)
         ID3D11DeviceContext_Release(va->sys->d3dctx);
+    if (dx_sys->d3ddev)
+        ID3D11Device_Release(dx_sys->d3ddev);
 }
 /**
  * It describes our Direct3D object
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 49112f6bdf..5fe739117e 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -436,8 +436,6 @@ void directx_va_Close(vlc_va_t *va, directx_sys_t *dx_sys)
     if (dx_sys->pf_destroy_device_manager)
         dx_sys->pf_destroy_device_manager(va);
     dx_sys->pf_destroy_device(va);
-    if (dx_sys->d3ddev)
-        IUnknown_Release( dx_sys->d3ddev );
 
     if (dx_sys->hdecoder_dll)
         FreeLibrary(dx_sys->hdecoder_dll);
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 3e92a638fe..2876caae24 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -430,8 +430,11 @@ static int D3dCreateDevice(vlc_va_t *va)
  */
 static void D3dDestroyDevice(vlc_va_t *va)
 {
+    directx_sys_t *dx_sys = &va->sys->dx_sys;
     if (va->sys->d3dobj)
         IDirect3D9_Release(va->sys->d3dobj);
+    if (dx_sys->d3ddev)
+        IDirect3DDevice9_Release(dx_sys->d3ddev);
 }
 /**
  * It describes our Direct3D object
-- 
2.12.1



More information about the vlc-devel mailing list