1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-19 13:21:13 +00:00

timer: remove unnecesary time conversions

This commit is contained in:
Kacper Michajłow 2023-10-22 04:24:54 +02:00 committed by Dudemanguy
parent e268dead30
commit 076be24853
4 changed files with 4 additions and 4 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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);

View File

@ -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))