bluez5: Fix node creation depending on device role

We can't determine which remote endpoint or device the
SelectConfiguration() call is associated with. For LE Audio BAP, as this
method is called only for the Initiator we set the whole instance as a
Central/Initiator.
This flag is unset on BAP media endpoint removal.
This commit is contained in:
Frédéric Danis 2022-07-22 11:01:18 +02:00 committed by Wim Taymans
parent e0c79959fc
commit cd50188787
5 changed files with 46 additions and 11 deletions

View file

@ -136,6 +136,7 @@ struct impl {
unsigned int started:1;
unsigned int following:1;
unsigned int is_output:1;
unsigned int is_duplex:1;
@ -1123,8 +1124,10 @@ static void emit_node_info(struct impl *this, bool full)
{
struct spa_dict_item node_info_items[] = {
{ SPA_KEY_DEVICE_API, "bluez5" },
{ SPA_KEY_MEDIA_CLASS, "Audio/Sink" },
{ SPA_KEY_NODE_DRIVER, "true" },
{ SPA_KEY_MEDIA_CLASS, this->is_output ? "Audio/Sink" : "Stream/Input/Audio" },
{ "media.name", ((this->transport && this->transport->device->name) ?
this->transport->device->name : this->codec->bap ? "BAP" : "A2DP" ) },
{ SPA_KEY_NODE_DRIVER, this->is_output ? "true" : "false" },
};
uint64_t old = full ? this->info.change_mask : 0;
if (full)
@ -1775,6 +1778,9 @@ impl_init(const struct spa_handle_factory *factory,
this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0,
this->transport->device->settings);
if (this->codec->bap)
this->is_output = this->transport->bap_initiator;
reset_props(this, &this->props);
spa_bt_transport_add_listener(this->transport,