summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-04-17 18:29:32 +0200
committerJan Ekström <jeebjp@gmail.com>2018-04-18 01:17:41 +0300
commit10584159df2c27998b2178ec32e707f2e167ed12 (patch)
tree76af2e1d38fb0f3d1966d51fdfaac6f04be85b0d
parent11c573fda0b96a55ae1b76436b9425bc5ca5a9b2 (diff)
downloadmpv-10584159df2c27998b2178ec32e707f2e167ed12.tar.bz2
mpv-10584159df2c27998b2178ec32e707f2e167ed12.tar.xz
w32_common: avoid recursive dispatch queue calls
I suppose this doesn't matter in practice, i.e. even if calls relayed over the dispatch queue will cause WndProc to be invoked, WndProc will never run for a longer time. Preparation for removing recursion support from the dispatch queue code.
-rw-r--r--video/out/w32_common.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index feeae81462..de81b35dca 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -79,6 +79,7 @@ struct vo_w32_state {
pthread_t thread;
bool terminate;
struct mp_dispatch_queue *dispatch; // used to run stuff on the GUI thread
+ bool in_dispatch;
struct w32_api api; // stores functions from dynamically loaded DLLs
@@ -920,7 +921,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
// The dispatch queue should be processed as soon as possible to prevent
// playback glitches, since it is likely blocking the VO thread
- mp_dispatch_queue_process(w32->dispatch, 0);
+ if (!w32->in_dispatch) {
+ w32->in_dispatch = true;
+ mp_dispatch_queue_process(w32->dispatch, 0);
+ w32->in_dispatch = false;
+ }
switch (message) {
case WM_ERASEBKGND: // no need to erase background separately