From c6760105df48713e970fadcd29ba880f10499832 Mon Sep 17 00:00:00 2001 From: Silviu Florian Barbulescu Date: Wed, 9 Aug 2023 13:10:36 +0300 Subject: [PATCH] Fix problems found in the review. --- spa/plugins/bluez5/bluez5-dbus.c | 19 ++++++++++++------- spa/plugins/bluez5/bluez5-device.c | 10 +++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-dbus.c b/spa/plugins/bluez5/bluez5-dbus.c index 7518461e3..f9d0a2440 100644 --- a/spa/plugins/bluez5/bluez5-dbus.c +++ b/spa/plugins/bluez5/bluez5-dbus.c @@ -2379,18 +2379,15 @@ static struct spa_bt_device* create_bcast_device(struct spa_bt_monitor *monitor, object_path); return NULL; } - else { - spa_log_warn(monitor->log, "created device %s", d->path); - } d->adapter = adapter_find(monitor, object_path); if (d->adapter == NULL) { - spa_log_info(monitor->log, "unknown adapter %s", d->adapter_path ); + spa_log_warn(monitor->log, "unknown adapter %s", d->adapter_path); } d->adapter_path = d->adapter->path; - d->alias = "bcast_device"; - d->name = "bcast_device"; - d->address = "00:00:00:00:00:00"; + d->alias = strdup("bcast_device"); + d->name = strdup("bcast_device"); + d->address = strdup("00:00:00:00:00:00"); spa_bt_device_check_profiles(d, false); d->reconnect_state = BT_DEVICE_RECONNECT_INIT; @@ -2448,6 +2445,9 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en */ if(spa_streq(remote_endpoint->uuid, SPA_BT_UUID_BAP_BROADCAST_SINK)) { device = create_bcast_device(monitor, value); + if(device == NULL) { + goto next; + } remote_endpoint->acceptor = true; device_set_connected(device, 1); } else { @@ -3495,6 +3495,7 @@ finish: spa_log_error(monitor->log, "transport %p: transport_create_iso_io failed", transport); /* For broadcast there initiator moves the transport state to SPA_BT_TRANSPORT_STATE_ACTIVE */ + /* TODO: handeling multiple BIGs support */ if(transport->profile == SPA_BT_PROFILE_BAP_BROADCAST_SINK) { spa_bt_transport_set_state(transport, SPA_BT_TRANSPORT_STATE_ACTIVE); } else { @@ -4913,6 +4914,10 @@ static void unregister_media_application(struct spa_bt_monitor * monitor) unregister_media_endpoint(monitor, codec, SPA_BT_MEDIA_SOURCE); unregister_media_endpoint(monitor, codec, SPA_BT_MEDIA_SINK); + if(codec->bap) + { + unregister_media_endpoint(monitor, codec, SPA_BT_MEDIA_SOURCE_BROADCAST); + } } dbus_connection_unregister_object_path(monitor->conn, BAP_OBJECT_MANAGER_PATH); diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index aef4608e1..00296bc0f 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -1055,11 +1055,7 @@ static int emit_nodes(struct impl *this) t = find_transport(this, SPA_BT_PROFILE_BAP_BROADCAST_SINK, this->props.codec); if (t) { this->props.codec = t->media_codec->id; - if (t->bap_initiator) - emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, false); - else - emit_dynamic_node(&this->dyn_media_sink, this, t, - DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, false); + emit_node(this, t, DEVICE_ID_SINK, SPA_NAME_API_BLUEZ5_MEDIA_SINK, false); } if (this->device_set.leader && this->device_set.sinks > 0) @@ -1698,10 +1694,12 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * switch (profile) { case SPA_BT_PROFILE_BAP_SINK: + case SPA_BT_PROFILE_BAP_BROADCAST_SINK: desc_and_codec = spa_aprintf(_("High Fidelity Playback (BAP Sink, codec %s)"), media_codec->description); break; case SPA_BT_PROFILE_BAP_SOURCE: + case SPA_BT_PROFILE_BAP_BROADCAST_SOURCE: desc_and_codec = spa_aprintf(_("High Fidelity Input (BAP Source, codec %s)"), media_codec->description); break; @@ -1714,9 +1712,11 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder * } else { switch (profile) { case SPA_BT_PROFILE_BAP_SINK: + case SPA_BT_PROFILE_BAP_BROADCAST_SINK: desc = _("High Fidelity Playback (BAP Sink)"); break; case SPA_BT_PROFILE_BAP_SOURCE: + case SPA_BT_PROFILE_BAP_BROADCAST_SOURCE: desc = _("High Fidelity Input (BAP Source)"); break; default: