summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2016-11-23 00:55:20 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2016-11-23 01:18:44 +1100
commit745862131f2e03bfb7b8fae4499d84522f0cc1a2 (patch)
treedac969ee6c36ac9ba42bec646565a42dae0f08c6 /video/decode
parentf843ae9983b62f81d0aa79a333e594855fe4ccf3 (diff)
downloadmpv-745862131f2e03bfb7b8fae4499d84522f0cc1a2.tar.bz2
mpv-745862131f2e03bfb7b8fae4499d84522f0cc1a2.tar.xz
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.)
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/d3d11va.c6
1 files changed, 5 insertions, 1 deletions
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) {