From b4d33843a668d5c3e1160cb9732ab9c2ea0a835f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 10 Dec 2021 12:31:44 +0100 Subject: [PATCH] bluez5: set clock name --- spa/plugins/bluez5/a2dp-sink.c | 9 +++++++++ spa/plugins/bluez5/a2dp-source.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/spa/plugins/bluez5/a2dp-sink.c b/spa/plugins/bluez5/a2dp-sink.c index aa0b4f3b0..1134fbf7b 100644 --- a/spa/plugins/bluez5/a2dp-sink.c +++ b/spa/plugins/bluez5/a2dp-sink.c @@ -59,10 +59,13 @@ static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.sink.a2dp") #undef SPA_LOG_TOPIC_DEFAULT #define SPA_LOG_TOPIC_DEFAULT &log_topic +#define DEFAULT_CLOCK_NAME "clock.system.monotonic" + struct props { uint32_t min_latency; uint32_t max_latency; int64_t latency_offset; + char clock_name[64]; }; #define FILL_FRAMES 2 @@ -173,6 +176,7 @@ static void reset_props(struct impl *this, struct props *props) } props->max_latency = MAX_LATENCY; props->latency_offset = 0; + strncpy(props->clock_name, DEFAULT_CLOCK_NAME, sizeof(props->clock_name)); } static int impl_node_enum_params(void *object, int seq, @@ -322,6 +326,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) switch (id) { case SPA_IO_Clock: this->clock = data; + if (this->clock != NULL) { + spa_scnprintf(this->clock->name, + sizeof(this->clock->name), + "%s", this->props.clock_name); + } break; case SPA_IO_Position: this->position = data; diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index cd23dffae..00e828358 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -60,9 +60,12 @@ static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.source.a2dp #undef SPA_LOG_TOPIC_DEFAULT #define SPA_LOG_TOPIC_DEFAULT &log_topic +#define DEFAULT_CLOCK_NAME "clock.system.monotonic" + struct props { uint32_t min_latency; uint32_t max_latency; + char clock_name[64]; }; #define FILL_FRAMES 2 @@ -166,6 +169,7 @@ static void reset_props(struct props *props) { props->min_latency = default_min_latency; props->max_latency = default_max_latency; + strncpy(props->clock_name, DEFAULT_CLOCK_NAME, sizeof(props->clock_name)); } static int impl_node_enum_params(void *object, int seq, @@ -285,6 +289,11 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size) switch (id) { case SPA_IO_Clock: this->clock = data; + if (this->clock != NULL) { + spa_scnprintf(this->clock->name, + sizeof(this->clock->name), + "%s", this->props.clock_name); + } break; case SPA_IO_Position: this->position = data;