summaryrefslogtreecommitdiffstats
path: root/video/out/x11_common.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-11-08 22:49:17 -0600
committerDudemanguy <random342@airmail.cc>2023-11-09 21:31:58 +0000
commit7d86807a5f71989e944269fa430f36f2f32b1d65 (patch)
treedb940e26c2d2971cb3287ab987c89549b89fa78d /video/out/x11_common.c
parenta89ba2c7497ca42f5b7e21144d5bf1a8da193654 (diff)
downloadmpv-7d86807a5f71989e944269fa430f36f2f32b1d65.tar.bz2
mpv-7d86807a5f71989e944269fa430f36f2f32b1d65.tar.xz
vo: don't sleep 1ms always when requested time is in the past
Fixes a899e14b which changed clamp from 0 to 1 ms which effectivelly introduced 1ms sleep always, even if requested until_time_ns is in the past and should request 0 timeout. While at it also fix mp_poll wrapper to respect negative timeout which should mean infinite wait. Also keep the 37d6604 behaviour for very short timeouts, but round only the ones > 100us, anything else is 0. Fixes: a899e14b
Diffstat (limited to 'video/out/x11_common.c')
-rw-r--r--video/out/x11_common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 9be2e9b93d..b4605bfd0b 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -2178,7 +2178,7 @@ void vo_x11_wait_events(struct vo *vo, int64_t until_time_ns)
{ .fd = x11->wakeup_pipe[0], .events = POLLIN },
};
int64_t wait_ns = until_time_ns - mp_time_ns();
- int64_t timeout_ns = MPCLAMP(wait_ns, 1e6, 1e10);
+ int64_t timeout_ns = MPCLAMP(wait_ns, 0, MP_TIME_S_TO_NS(10));
mp_poll(fds, 2, timeout_ns);