From 0cdcd04f77ae8ce44382903b76b76b07a446d00b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 May 2022 09:53:37 +0200 Subject: [PATCH] bluez5: use position clock time Use the position clock time and fall back to the monotonic time. --- spa/plugins/bluez5/a2dp-sink.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index 3d4dfc1f0..eae0843d9 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -1479,9 +1479,13 @@ static int impl_node_process(void *object) } if (!spa_list_is_empty(&port->ready)) { if (this->following) { - struct timespec now; - spa_system_clock_gettime(this->data_system, CLOCK_MONOTONIC, &now); - this->current_time = SPA_TIMESPEC_TO_NSEC(&now); + if (this->position) { + this->current_time = this->position->clock.nsec; + } else { + struct timespec now; + spa_system_clock_gettime(this->data_system, CLOCK_MONOTONIC, &now); + this->current_time = SPA_TIMESPEC_TO_NSEC(&now); + } } if (this->need_flush) reset_buffer(this);