diff --git a/filters/filter.c b/filters/filter.c index eb757f5753..80ec6ddff3 100644 --- a/filters/filter.c +++ b/filters/filter.c @@ -214,7 +214,7 @@ bool mp_filter_graph_run(struct mp_filter *filter) int64_t end_time = 0; if (isfinite(r->max_run_time)) - end_time = mp_add_timeout(mp_time_us(), MPMAX(r->max_run_time, 0)); + end_time = mp_time_us_add(mp_time_us(), MPMAX(r->max_run_time, 0)); // (could happen with separate filter graphs calling each other, for now // ignore this issue as we don't use such a setup anywhere) diff --git a/misc/dispatch.c b/misc/dispatch.c index e491b2a9b0..4d24409856 100644 --- a/misc/dispatch.c +++ b/misc/dispatch.c @@ -272,7 +272,7 @@ void mp_dispatch_run(struct mp_dispatch_queue *queue, void mp_dispatch_queue_process(struct mp_dispatch_queue *queue, double timeout) { pthread_mutex_lock(&queue->lock); - queue->wait = timeout > 0 ? mp_add_timeout(mp_time_us(), timeout) : 0; + queue->wait = timeout > 0 ? mp_time_us_add(mp_time_us(), timeout) : 0; assert(!queue->in_process); // recursion not allowed queue->in_process = true; queue->in_process_thread = pthread_self(); diff --git a/osdep/timer.c b/osdep/timer.c index 2e184c3026..6f8d992a1e 100644 --- a/osdep/timer.c +++ b/osdep/timer.c @@ -60,7 +60,7 @@ double mp_time_sec(void) return mp_time_us() / (double)(1000 * 1000); } -int64_t mp_add_timeout(int64_t time_us, double timeout_sec) +int64_t mp_time_us_add(int64_t time_us, double timeout_sec) { assert(time_us > 0); // mp_time_us() returns strictly positive values double t = MPCLAMP(timeout_sec * (1000 * 1000), -0x1p63, 0x1p63); @@ -111,5 +111,5 @@ struct timespec mp_time_us_to_realtime(int64_t time_us) struct timespec mp_rel_time_to_timespec(double timeout_sec) { - return mp_time_us_to_realtime(mp_add_timeout(mp_time_us(), timeout_sec)); + return mp_time_us_to_realtime(mp_time_us_add(mp_time_us(), timeout_sec)); } diff --git a/osdep/timer.h b/osdep/timer.h index b98c275697..a511812b56 100644 --- a/osdep/timer.h +++ b/osdep/timer.h @@ -52,7 +52,7 @@ void mp_end_hires_timers(int resolution_ms); // Add a time in seconds to the given time in microseconds, and return it. // Takes care of possible overflows. Never returns a negative or 0 time. -int64_t mp_add_timeout(int64_t time_us, double timeout_sec); +int64_t mp_time_us_add(int64_t time_us, double timeout_sec); // Convert the mp time in microseconds to a timespec using CLOCK_REALTIME. struct timespec mp_time_us_to_realtime(int64_t time_us); diff --git a/player/client.c b/player/client.c index 0f3a99f3f6..71e4fb99c7 100644 --- a/player/client.c +++ b/player/client.c @@ -905,7 +905,7 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout) if (timeout < 0) timeout = 1e20; - int64_t deadline = mp_add_timeout(mp_time_us(), timeout); + int64_t deadline = mp_time_us_add(mp_time_us(), timeout); *event = (mpv_event){0}; talloc_free_children(event); diff --git a/player/playloop.c b/player/playloop.c index 792e989b5c..e7f0a0c3e4 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -75,7 +75,7 @@ void mp_set_timeout(struct MPContext *mpctx, double sleeptime) { if (mpctx->sleeptime > sleeptime) { mpctx->sleeptime = sleeptime; - int64_t abstime = mp_add_timeout(mp_time_us(), sleeptime); + int64_t abstime = mp_time_us_add(mp_time_us(), sleeptime); mp_dispatch_adjust_timeout(mpctx->dispatch, abstime); } } diff --git a/test/test_utils.c b/test/test_utils.c index b75fe839b1..650e88d111 100644 --- a/test/test_utils.c +++ b/test/test_utils.c @@ -108,7 +108,7 @@ void mp_write_console_ansi(void) {}; void mp_set_avdict(AVDictionary **dict, char **kv) {}; #ifndef WIN32_TESTS -void mp_add_timeout(void) {}; +void mp_time_us_add(void) {}; void mp_rel_time_to_timespec(void) {}; void mp_time_us(void) {}; void mp_time_us_to_realtime(void) {}; diff --git a/test/test_utils.h b/test/test_utils.h index 57c2d9c614..65202050eb 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -59,7 +59,7 @@ void mp_set_avdict(AVDictionary **dict, char **kv); // import the real versions of these functions and use them. On other // platforms, these can just be stubs for simplicity. #ifndef WIN32_TESTS -void mp_add_timeout(void); +void mp_time_us_add(void); void mp_rel_time_to_timespec(void); void mp_time_us(void); void mp_time_us_to_realtime(void); diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 0827da6fc9..a5b8e3b2f4 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -786,7 +786,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. - struct timespec e = mp_time_us_to_realtime(mp_add_timeout(mp_time_us(), 0.1)); + struct timespec e = mp_time_us_to_realtime(mp_time_us_add(mp_time_us(), 0.1)); while (s->frame_w != width && s->frame_h != height && s->vo_ready) { if (pthread_cond_timedwait(&s->wakeup, &s->lock, &e)) break;