[vlc-commits] dxva2: only keep a reference to the DXVA2 DLL in the DXVA2 pictures
Steve Lhomme
git at videolan.org
Fri Dec 13 10:12:58 CET 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Dec 11 11:17:21 2019 +0100| [c8dea138b7b228cbaa1833072648c9ee05de16f8] | committer: Steve Lhomme
dxva2: only keep a reference to the DXVA2 DLL in the DXVA2 pictures
The others don't allocate surfaces from that DLL.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c8dea138b7b228cbaa1833072648c9ee05de16f8
---
modules/codec/avcodec/dxva2.c | 4 ++++
modules/video_chroma/d3d9_fmt.h | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 3ef809cd75..16f8f5714c 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -41,6 +41,7 @@ struct dxva2_pic_context
{
struct d3d9_pic_context ctx;
struct vlc_va_surface_t *va_surface;
+ HINSTANCE dxva2_dll;
};
#define DXVA2_PICCONTEXT_FROM_PICCTX(pic_ctx) \
@@ -162,10 +163,12 @@ static void dxva2_pic_context_destroy(picture_context_t *ctx)
{
struct dxva2_pic_context *pic_ctx = DXVA2_PICCONTEXT_FROM_PICCTX(ctx);
struct vlc_va_surface_t *va_surface = pic_ctx->va_surface;
+ HINSTANCE dxva2_dll = pic_ctx->dxva2_dll;
static_assert(offsetof(struct dxva2_pic_context, ctx.s) == 0,
"Cast assumption failure");
d3d9_pic_context_destroy(ctx);
va_surface_Release(va_surface);
+ FreeLibrary(dxva2_dll);
}
static picture_context_t *dxva2_pic_context_copy(picture_context_t *ctx)
@@ -202,6 +205,7 @@ static picture_context_t* NewSurfacePicContext(vlc_va_t *va, vlc_va_surface_t *v
if (unlikely(pic_ctx==NULL))
return NULL;
pic_ctx->va_surface = va_surface;
+ pic_ctx->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
return &pic_ctx->ctx.s;
}
diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h
index 50dc0e8092..9647c9b623 100644
--- a/modules/video_chroma/d3d9_fmt.h
+++ b/modules/video_chroma/d3d9_fmt.h
@@ -35,7 +35,6 @@
typedef struct
{
IDirect3DSurface9 *surface;
- HINSTANCE dxva2_dll;
} picture_sys_d3d9_t;
struct d3d9_pic_context
@@ -127,13 +126,11 @@ static inline d3d9_video_context_t *GetD3D9ContextPrivate(vlc_video_context *vct
static inline void AcquireD3D9PictureSys(picture_sys_d3d9_t *p_sys)
{
IDirect3DSurface9_AddRef(p_sys->surface);
- p_sys->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
}
static inline void ReleaseD3D9PictureSys(picture_sys_d3d9_t *p_sys)
{
IDirect3DSurface9_Release(p_sys->surface);
- FreeLibrary(p_sys->dxva2_dll);
}
HRESULT D3D9_CreateDevice(vlc_object_t *, d3d9_handle_t *, int,
More information about the vlc-commits
mailing list