summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-09-15 01:39:35 +0200
committerDudemanguy <random342@airmail.cc>2023-09-29 20:48:58 +0000
commitda4c4d2ebd2473677045b85f923cb14349b1e60d (patch)
tree9c664eae20220d598bb3ce336a5d7c7cbe3973e9
parent381386330bd3663055250e6883f1c0c1e4069eec (diff)
downloadmpv-da4c4d2ebd2473677045b85f923cb14349b1e60d.tar.bz2
mpv-da4c4d2ebd2473677045b85f923cb14349b1e60d.tar.xz
timer: rename mp_time_us_to_timespec to reflect what it actually does
-rw-r--r--demux/demux.c2
-rw-r--r--misc/dispatch.c2
-rw-r--r--osdep/timer.c6
-rw-r--r--osdep/timer.h2
-rw-r--r--player/client.c2
-rw-r--r--test/test_utils.c2
-rw-r--r--test/test_utils.h2
-rw-r--r--video/out/cocoa_common.m2
-rw-r--r--video/out/vo.c4
9 files changed, 12 insertions, 12 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 575ccc227d..0e125dc660 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -2557,7 +2557,7 @@ static void *demux_thread(void *pctx)
if (thread_work(in))
continue;
pthread_cond_signal(&in->wakeup);
- struct timespec until = mp_time_us_to_timespec(in->next_cache_update);
+ struct timespec until = mp_time_us_to_realtime(in->next_cache_update);
pthread_cond_timedwait(&in->wakeup, &in->lock, &until);
}
diff --git a/misc/dispatch.c b/misc/dispatch.c
index 0c3c574afa..e491b2a9b0 100644
--- a/misc/dispatch.c
+++ b/misc/dispatch.c
@@ -310,7 +310,7 @@ void mp_dispatch_queue_process(struct mp_dispatch_queue *queue, double timeout)
item->completed = true;
}
} else if (queue->wait > 0 && !queue->interrupted) {
- struct timespec ts = mp_time_us_to_timespec(queue->wait);
+ struct timespec ts = mp_time_us_to_realtime(queue->wait);
if (pthread_cond_timedwait(&queue->cond, &queue->lock, &ts))
queue->wait = 0;
} else {
diff --git a/osdep/timer.c b/osdep/timer.c
index 8a52823b0f..0943ab3871 100644
--- a/osdep/timer.c
+++ b/osdep/timer.c
@@ -85,7 +85,7 @@ static void get_realtime(struct timespec *out_ts)
#endif
}
-struct timespec mp_time_us_to_timespec(int64_t time_us)
+struct timespec mp_time_us_to_realtime(int64_t time_us)
{
struct timespec ts;
get_realtime(&ts);
@@ -112,7 +112,7 @@ struct timespec mp_time_us_to_timespec(int64_t time_us)
struct timespec mp_rel_time_to_timespec(double timeout_sec)
{
- return mp_time_us_to_timespec(mp_add_timeout(mp_time_us(), timeout_sec));
+ return mp_time_us_to_realtime(mp_add_timeout(mp_time_us(), timeout_sec));
}
#if 0
@@ -137,7 +137,7 @@ int main(void) {
#if TEST_SLEEP
mp_sleep_us(delay);
#else
- struct timespec ts = mp_time_us_to_timespec(r + delay);
+ struct timespec ts = mp_time_us_to_realtime(r + delay);
pthread_cond_timedwait(&cnd, &mtx, &ts);
#endif
j = (mp_time_us() - r) - delay;
diff --git a/osdep/timer.h b/osdep/timer.h
index 8cc1d9dc27..b98c275697 100644
--- a/osdep/timer.h
+++ b/osdep/timer.h
@@ -55,7 +55,7 @@ void mp_end_hires_timers(int resolution_ms);
int64_t mp_add_timeout(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_timespec(int64_t time_us);
+struct timespec mp_time_us_to_realtime(int64_t time_us);
// Convert the relative timeout in seconds to a timespec.
// The timespec is absolute, using CLOCK_REALTIME.
diff --git a/player/client.c b/player/client.c
index 2a581a6bda..0f3a99f3f6 100644
--- a/player/client.c
+++ b/player/client.c
@@ -363,7 +363,7 @@ static int wait_wakeup(struct mpv_handle *ctx, int64_t end)
pthread_mutex_unlock(&ctx->lock);
pthread_mutex_lock(&ctx->wakeup_lock);
if (!ctx->need_wakeup) {
- struct timespec ts = mp_time_us_to_timespec(end);
+ struct timespec ts = mp_time_us_to_realtime(end);
r = pthread_cond_timedwait(&ctx->wakeup, &ctx->wakeup_lock, &ts);
}
if (r == 0)
diff --git a/test/test_utils.c b/test/test_utils.c
index 92f083ffbe..b75fe839b1 100644
--- a/test/test_utils.c
+++ b/test/test_utils.c
@@ -111,5 +111,5 @@ void mp_set_avdict(AVDictionary **dict, char **kv) {};
void mp_add_timeout(void) {};
void mp_rel_time_to_timespec(void) {};
void mp_time_us(void) {};
-void mp_time_us_to_timespec(void) {};
+void mp_time_us_to_realtime(void) {};
#endif
diff --git a/test/test_utils.h b/test/test_utils.h
index b776dedf08..57c2d9c614 100644
--- a/test/test_utils.h
+++ b/test/test_utils.h
@@ -62,5 +62,5 @@ void mp_set_avdict(AVDictionary **dict, char **kv);
void mp_add_timeout(void);
void mp_rel_time_to_timespec(void);
void mp_time_us(void);
-void mp_time_us_to_timespec(void);
+void mp_time_us_to_realtime(void);
#endif
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 5d5a423fe3..0827da6fc9 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_timespec(mp_add_timeout(mp_time_us(), 0.1));
+ struct timespec e = mp_time_us_to_realtime(mp_add_timeout(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;
diff --git a/video/out/vo.c b/video/out/vo.c
index 7f57df2fe1..23f75e72d5 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -719,7 +719,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_timespec(until_time);
+ struct timespec ts = mp_time_us_to_realtime(until_time);
pthread_cond_timedwait(&in->wakeup, &in->lock, &ts);
}
pthread_mutex_unlock(&in->lock);
@@ -867,7 +867,7 @@ void vo_wait_frame(struct vo *vo)
static void wait_until(struct vo *vo, int64_t target)
{
struct vo_internal *in = vo->in;
- struct timespec ts = mp_time_us_to_timespec(target);
+ struct timespec ts = mp_time_us_to_realtime(target);
pthread_mutex_lock(&in->lock);
while (target > mp_time_us()) {
if (in->queued_events & VO_EVENT_LIVE_RESIZING)