From 7d86807a5f71989e944269fa430f36f2f32b1d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Wed, 8 Nov 2023 22:49:17 -0600 Subject: 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 --- video/out/wayland_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index 0ee49541ed..ca1d17bb2d 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -2611,7 +2611,7 @@ void vo_wayland_wait_events(struct vo *vo, int64_t until_time_ns) struct vo_wayland_state *wl = vo->wl; 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)); wayland_dispatch_events(wl, 2, timeout_ns); } -- cgit v1.2.3