From 66c43e5af220d9d4ebb7ae6df8044285e0291a47 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Fri, 19 Mar 2021 20:21:12 +0200 Subject: [PATCH] bluez: sco-{source,sink}: adjust node properties for when acting as a stream Add media.name so that restore-stream can store this stream. Remove node.driver because the stream is slaved to the connected ALSA device. Remove pause-on-idle in all cases, as this is now configurable from the config file. --- spa/plugins/bluez5/sco-sink.c | 15 +++++++++++---- spa/plugins/bluez5/sco-source.c | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/spa/plugins/bluez5/sco-sink.c b/spa/plugins/bluez5/sco-sink.c index e84cf6498..428443bd2 100644 --- a/spa/plugins/bluez5/sco-sink.c +++ b/spa/plugins/bluez5/sco-sink.c @@ -679,17 +679,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman static void emit_node_info(struct impl *this, bool full) { bool is_ag = (this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY); - struct spa_dict_item node_info_items[] = { + struct spa_dict_item ag_node_info_items[] = { { SPA_KEY_DEVICE_API, "bluez5" }, - { SPA_KEY_MEDIA_CLASS, is_ag ? "Stream/Input/Audio" : "Audio/Sink" }, + { SPA_KEY_MEDIA_CLASS, "Stream/Input/Audio" }, + { "media.name", ((this->transport && this->transport->device->name) ? + this->transport->device->name : "HSP/HFP") }, + }; + struct spa_dict_item hu_node_info_items[] = { + { SPA_KEY_DEVICE_API, "bluez5" }, + { SPA_KEY_MEDIA_CLASS, "Audio/Sink" }, { SPA_KEY_NODE_DRIVER, "true" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, }; if (full) this->info.change_mask = this->info_all; if (this->info.change_mask) { - this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items); + this->info.props = is_ag ? + &SPA_DICT_INIT_ARRAY(ag_node_info_items) : + &SPA_DICT_INIT_ARRAY(hu_node_info_items); spa_node_emit_info(&this->hooks, &this->info); this->info.change_mask = 0; } diff --git a/spa/plugins/bluez5/sco-source.c b/spa/plugins/bluez5/sco-source.c index e514eaa38..b2d572a46 100644 --- a/spa/plugins/bluez5/sco-source.c +++ b/spa/plugins/bluez5/sco-source.c @@ -688,17 +688,24 @@ static int impl_node_send_command(void *object, const struct spa_command *comman static void emit_node_info(struct impl *this, bool full) { bool is_ag = (this->transport->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY); - struct spa_dict_item node_info_items[] = { + struct spa_dict_item ag_node_info_items[] = { { SPA_KEY_DEVICE_API, "bluez5" }, - { SPA_KEY_MEDIA_CLASS, is_ag ? "Stream/Output/Audio" : "Audio/Source" }, + { SPA_KEY_MEDIA_CLASS, "Stream/Output/Audio" }, + { "media.name", ((this->transport && this->transport->device->name) ? + this->transport->device->name : "HSP/HFP") }, + }; + struct spa_dict_item hu_node_info_items[] = { + { SPA_KEY_DEVICE_API, "bluez5" }, + { SPA_KEY_MEDIA_CLASS, "Audio/Source" }, { SPA_KEY_NODE_DRIVER, "true" }, - { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" }, }; if (full) this->info.change_mask = this->info_all; if (this->info.change_mask) { - this->info.props = &SPA_DICT_INIT_ARRAY(node_info_items); + this->info.props = is_ag ? + &SPA_DICT_INIT_ARRAY(ag_node_info_items) : + &SPA_DICT_INIT_ARRAY(hu_node_info_items); spa_node_emit_info(&this->hooks, &this->info); this->info.change_mask = 0; }