summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-11 14:32:48 -0500
committerDudemanguy <random342@airmail.cc>2023-10-16 15:38:59 +0000
commit9ac0085031aff86a9705514be270842f046dc002 (patch)
tree60fc8c9b7635bcd387750ee2c919741905f8b17d
parent0fd8f0b3c10f20c8026d3ade5d2b075fa67ef90c (diff)
downloadmpv-9ac0085031aff86a9705514be270842f046dc002.tar.bz2
mpv-9ac0085031aff86a9705514be270842f046dc002.tar.xz
dispatch: change mp_dispatch_queue_process timer to nanoseconds
The playloop is the only thing that adjusts the timeout with a value other than 0, so nothing else needs to be changed.
-rw-r--r--misc/dispatch.c4
-rw-r--r--player/playloop.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/misc/dispatch.c b/misc/dispatch.c
index 4d24409856..d88d775d97 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_time_us_add(mp_time_us(), timeout) : 0;
+ queue->wait = timeout > 0 ? mp_time_ns_add(mp_time_ns(), timeout) : 0;
assert(!queue->in_process); // recursion not allowed
queue->in_process = true;
queue->in_process_thread = pthread_self();
@@ -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_realtime(queue->wait);
+ struct timespec ts = mp_time_ns_to_realtime(queue->wait);
if (pthread_cond_timedwait(&queue->cond, &queue->lock, &ts))
queue->wait = 0;
} else {
diff --git a/player/playloop.c b/player/playloop.c
index eb42a3131c..60596da76d 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_time_us_add(mp_time_us(), sleeptime);
+ int64_t abstime = mp_time_ns_add(mp_time_ns(), sleeptime);
mp_dispatch_adjust_timeout(mpctx->dispatch, abstime);
}
}