From 54383b84ec91d23ef56afb1b1d4240e3128b9c5d Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 3 Apr 2019 20:44:50 -0700 Subject: [PATCH] Fix random deadlocks on window resize with the software decoder due to processing window messages off the render thread --- app/streaming/video/ffmpeg-renderers/sdlvid.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp index a1f43ca3..c98ea3fc 100644 --- a/app/streaming/video/ffmpeg-renderers/sdlvid.cpp +++ b/app/streaming/video/ffmpeg-renderers/sdlvid.cpp @@ -143,6 +143,14 @@ bool SdlRenderer::initialize(SDL_Window* window, } } +#ifdef Q_OS_WIN32 + // We render on a different thread than the main thread which is handling window + // messages. Without D3DCREATE_MULTITHREADED, this can cause a deadlock by blocking + // on a window message being processed while the main thread is blocked waiting for + // the render thread to finish. + SDL_SetHintWithPriority(SDL_HINT_RENDER_DIRECT3D_THREADSAFE, "1", SDL_HINT_OVERRIDE); +#endif + m_Renderer = SDL_CreateRenderer(window, -1, rendererFlags); if (!m_Renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,