diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2023-10-22 04:24:54 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-11-05 17:36:17 +0000 |
commit | 076be248532e3fa0b261addb9c6dc93563d02644 (patch) | |
tree | ed3b626d307369dcb7c8976ab2598058a2dfbead | |
parent | e268dead30255fdc1207f3c2466b4132c97bb078 (diff) | |
download | mpv-076be248532e3fa0b261addb9c6dc93563d02644.tar.bz2 mpv-076be248532e3fa0b261addb9c6dc93563d02644.tar.xz |
timer: remove unnecesary time conversions
-rw-r--r-- | misc/thread_pool.c | 2 | ||||
-rw-r--r-- | video/out/cocoa_common.m | 2 | ||||
-rw-r--r-- | video/out/vo_libmpv.c | 2 | ||||
-rw-r--r-- | video/out/vo_rpi.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/misc/thread_pool.c b/misc/thread_pool.c index f57dc8cfcf..e20d9d07e6 100644 --- a/misc/thread_pool.c +++ b/misc/thread_pool.c @@ -71,7 +71,7 @@ static MP_THREAD_VOID worker_thread(void *arg) if (pool->num_threads > pool->min_threads) { if (!destroy_deadline) - destroy_deadline = mp_time_ns_add(mp_time_ns(), DESTROY_TIMEOUT); + destroy_deadline = mp_time_ns() + MP_TIME_S_TO_NS(DESTROY_TIMEOUT); if (mp_cond_timedwait_until(&pool->wakeup, &pool->lock, destroy_deadline)) got_timeout = pool->num_threads > pool->min_threads; } else { diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 1449da8c75..256671ef19 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -787,7 +787,7 @@ static void vo_cocoa_resize_redraw(struct vo *vo, int width, int height) // Wait until a new frame with the new size was rendered. For some reason, // Cocoa requires this to be done before drawRect() returns. - int64_t e = mp_time_ns_add(mp_time_ns(), 0.1); + int64_t e = mp_time_ns() + MP_TIME_MS_TO_NS(100); while (s->frame_w != width && s->frame_h != height && s->vo_ready) { if (mp_cond_timedwait_until(&s->wakeup, &s->lock, e)) break; diff --git a/video/out/vo_libmpv.c b/video/out/vo_libmpv.c index 1efdcdd75b..972588ee3e 100644 --- a/video/out/vo_libmpv.c +++ b/video/out/vo_libmpv.c @@ -500,7 +500,7 @@ static void flip_page(struct vo *vo) { struct vo_priv *p = vo->priv; struct mpv_render_context *ctx = p->ctx; - int64_t until = mp_time_ns_add(mp_time_ns(), 0.2); + int64_t until = mp_time_ns() + MP_TIME_MS_TO_NS(200); mp_mutex_lock(&ctx->lock); diff --git a/video/out/vo_rpi.c b/video/out/vo_rpi.c index e0ee85c162..55f1a68edb 100644 --- a/video/out/vo_rpi.c +++ b/video/out/vo_rpi.c @@ -477,7 +477,7 @@ static void wait_next_vsync(struct vo *vo) { struct priv *p = vo->priv; mp_mutex_lock(&p->display_mutex); - int64_t end = mp_time_ns_add(mp_time_ns(), 0.050); + int64_t end = mp_time_ns() + MP_TIME_MS_TO_NS(50); int64_t old = p->vsync_counter; while (old == p->vsync_counter && !p->reload_display) { if (mp_cond_timedwait_until(&p->display_cond, &p->display_mutex, end)) |