diff options
author | Dudemanguy <random342@airmail.cc> | 2023-09-17 21:34:32 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-10-10 19:10:55 +0000 |
commit | a899e14bccb667af243f8fce454160e17ae45c2a (patch) | |
tree | 77fede3fe581c4cedbe6cf04f456e16937374dfb /video/out/vo.c | |
parent | c82c55b4b9d4015ba79fb36170defb328563cdea (diff) | |
download | mpv-a899e14bccb667af243f8fce454160e17ae45c2a.tar.bz2 mpv-a899e14bccb667af243f8fce454160e17ae45c2a.tar.xz |
vo: change vo->driver->wait_events to nanoseconds
In many cases, this is purely cosmetic because poll still only accepts
microseconds. There's still a gain here however since
pthread_cond_timedwait can take a realtime ts now.
Additionally, 37d6604d70c8c594de2817db26356c4c950ac0fd changed the value
added to timeout_ms in X11 and Wayland to ensure that it would never be
0 and rounded up. This was both incomplete, several other parts of the
player have this same problem like drm, and not really needed. Instead
the MPCLAMP is just adjusted to have a min of 1.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r-- | video/out/vo.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 7b50b90745..4fab586dfd 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -717,7 +717,7 @@ void vo_wait_default(struct vo *vo, int64_t until_time) pthread_mutex_lock(&in->lock); if (!in->need_wakeup) { - struct timespec ts = mp_time_us_to_realtime(until_time); + struct timespec ts = mp_time_ns_to_realtime(until_time); pthread_cond_timedwait(&in->wakeup, &in->lock, &ts); } pthread_mutex_unlock(&in->lock); @@ -1064,7 +1064,7 @@ static void *vo_thread(void *ptr) stats_event(in->stats, "iterations"); vo->driver->control(vo, VOCTRL_CHECK_EVENTS, NULL); bool working = render_frame(vo); - int64_t now = mp_time_us(); + int64_t now = mp_time_ns(); int64_t wait_until = now + (working ? 0 : (int64_t)1e9); pthread_mutex_lock(&in->lock); |