diff options
author | Dudemanguy <random342@airmail.cc> | 2023-09-29 17:24:21 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-10 19:10:55 +0000 |
commit | 59dd7d94af7651baf7e60966c5f8e7d52959d958 (patch) | |
tree | c6eb2938d2a63ebb07e377794f28ca708d786abd /video/out/vo_null.c | |
parent | fcebee9080a113f3248d218e451345db3f965b47 (diff) | |
download | mpv-59dd7d94af7651baf7e60966c5f8e7d52959d958.tar.bz2 mpv-59dd7d94af7651baf7e60966c5f8e7d52959d958.tar.xz |
timer: change mp_sleep_us to mp_sleep_ns
Linux and macOS already use nanosecond resolution for their sleep
functions. It was just being converted from microseconds before. Since
we have mp_time_ns now, go ahead and bump the precision here. The timer
for windows uses some timeBeginPeriod thing which I'm not sure what it
does really but whatever just convert the units to ms like they were
doing before. There's really no reason to keep the mp_sleep_us helper
around. A multiplication by 1000 is trivial and underlying OS clocks
have nanosecond precision.
Diffstat (limited to 'video/out/vo_null.c')
-rw-r--r-- | video/out/vo_null.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/video/out/vo_null.c b/video/out/vo_null.c index 2aa46f785f..0c49062e23 100644 --- a/video/out/vo_null.c +++ b/video/out/vo_null.c @@ -40,14 +40,14 @@ static void flip_page(struct vo *vo) { struct priv *p = vo->priv; if (p->cfg_fps) { - int64_t ft = 1e6 / p->cfg_fps; - int64_t prev_vsync = mp_time_us() / ft; + int64_t ft = 1e9 / p->cfg_fps; + int64_t prev_vsync = mp_time_ns() / ft; int64_t target_time = (prev_vsync + 1) * ft; for (;;) { - int64_t now = mp_time_us(); + int64_t now = mp_time_ns(); if (now >= target_time) break; - mp_sleep_us(target_time - now); + mp_sleep_ns(target_time - now); } } } |