From 745862131f2e03bfb7b8fae4499d84522f0cc1a2 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Wed, 23 Nov 2016 00:55:20 +1100 Subject: d3d11va: unconditionally load D3D DLLs At least with Nvidia drivers, some thread tries to access D3D11 objects after ANGLE unloads d3d11.dll. Fix this by holding a reference to d3d11.dll ourselves. Might fix the crash in #3348. (I wish I knew why though.) --- video/decode/d3d11va.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'video/decode') diff --git a/video/decode/d3d11va.c b/video/decode/d3d11va.c index 8ce07880e7..e31582d37c 100644 --- a/video/decode/d3d11va.c +++ b/video/decode/d3d11va.c @@ -429,7 +429,6 @@ static bool create_device(struct lavc_ctx *s, BOOL thread_safe) HRESULT hr; struct priv *p = s->hwdec_priv; - d3d_load_dlls(); if (!d3d11_dll) { MP_ERR(p, "Failed to load D3D11 library\n"); return false; @@ -492,6 +491,11 @@ static int d3d11va_init(struct lavc_ctx *s) if (!p) return -1; + // Unconditionally load Direct3D DLLs, even when using a VO-supplied D3D11 + // device. This prevents a crash that occurs at least with NVIDIA drivers, + // where D3D objects are accessed after ANGLE unloads d3d11.dll. + d3d_load_dlls(); + s->hwdec_priv = p; p->log = mp_log_new(s, s->log, "d3d11va"); if (s->hwdec->type == HWDEC_D3D11VA_COPY) { -- cgit v1.2.3