From e3064c3cb79284bba9c45a807cadce745c2e8357 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 13 Feb 2015 21:25:09 +0100 Subject: ipc: put playback core to sleep while dequeuing commands Happens to fix #1581 due to an unfortunate interaction with the way the VO does not react to commands for a while if a video frame is queued. Slightly improves other situations as well, if the client spams mpv with commands during playback. (cherry picked from commit 32b56c56bad78d8d3038361aef6f36ad9cabebb0) --- input/ipc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'input/ipc.c') diff --git a/input/ipc.c b/input/ipc.c index 2ad850e5ed..2e17fd4fac 100644 --- a/input/ipc.c +++ b/input/ipc.c @@ -531,9 +531,15 @@ static void *client_thread(void *p) }; fcntl(arg->client_fd, F_SETFL, fcntl(arg->client_fd, F_GETFL, 0) | O_NONBLOCK); + mpv_suspend(arg->client); while (1) { - rc = poll(fds, 2, -1); + rc = poll(fds, 2, 0); + if (rc == 0) { + mpv_resume(arg->client); + rc = poll(fds, 2, -1); + mpv_suspend(arg->client); + } if (rc < 0) { MP_ERR(arg, "Poll error\n"); continue; -- cgit v1.2.3