Skip to content

Commit

Permalink
timer: remove unnecesary time conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed Oct 22, 2023
1 parent 4d0a2e2 commit 08ae71f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion misc/thread_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion video/out/cocoa_common.m
Original file line number Diff line number Diff line change
Expand Up @@ -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(&s->wakeup, &s->lock, e))
break;
Expand Down
2 changes: 1 addition & 1 deletion video/out/vo_libmpv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion video/out/vo_rpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 08ae71f

Please sign in to comment.