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 32b56c56ba)
This commit is contained in:
wm4 2015-02-13 21:25:09 +01:00 committed by Diogo Franco (Kovensky)
parent df4d15be7b
commit e3064c3cb7
1 changed files with 7 additions and 1 deletions

View File

@ -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;