From ef74ef3654ca57f5e73407c2617f2a4674b19e45 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Sun, 28 Mar 2021 14:20:42 +0300 Subject: [PATCH] bluez5: use the actual latency in a2dp-source --- spa/plugins/bluez5/a2dp-source.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spa/plugins/bluez5/a2dp-source.c b/spa/plugins/bluez5/a2dp-source.c index 2d5d7d42a..e9f553f3a 100644 --- a/spa/plugins/bluez5/a2dp-source.c +++ b/spa/plugins/bluez5/a2dp-source.c @@ -745,10 +745,11 @@ static int impl_node_send_command(void *object, const struct spa_command *comman static void emit_node_info(struct impl *this, bool full) { + char latency[64] = SPA_STRINGIFY(MIN_LATENCY)"/48000"; struct spa_dict_item node_info_items[] = { { SPA_KEY_DEVICE_API, "bluez5" }, { SPA_KEY_MEDIA_CLASS, "Stream/Output/Audio" }, - { SPA_KEY_NODE_LATENCY, SPA_STRINGIFY(MIN_LATENCY)"/48000" }, + { SPA_KEY_NODE_LATENCY, latency }, { "media.name", ((this->transport && this->transport->device->name) ? this->transport->device->name : "A2DP") }, }; @@ -756,6 +757,9 @@ static void emit_node_info(struct impl *this, bool full) if (full) this->info.change_mask = this->info_all; if (this->info.change_mask) { + if (this->transport && this->port.have_format) + snprintf(latency, sizeof(latency), "%d/%d", (int)this->props.min_latency, + (int)this->port.current_format.info.raw.rate); this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items); spa_node_emit_info(&this->hooks, &this->info); this->info.change_mask = 0;