Fix problems found in the review.

This commit is contained in:
Silviu Florian Barbulescu 2023-08-09 13:10:36 +03:00 committed by Wim Taymans
parent b07bb4e106
commit c6760105df
2 changed files with 17 additions and 12 deletions

View file

@ -2379,18 +2379,15 @@ static struct spa_bt_device* create_bcast_device(struct spa_bt_monitor *monitor,
object_path); object_path);
return NULL; return NULL;
} }
else {
spa_log_warn(monitor->log, "created device %s", d->path);
}
d->adapter = adapter_find(monitor, object_path); d->adapter = adapter_find(monitor, object_path);
if (d->adapter == NULL) { 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->adapter_path = d->adapter->path;
d->alias = "bcast_device"; d->alias = strdup("bcast_device");
d->name = "bcast_device"; d->name = strdup("bcast_device");
d->address = "00:00:00:00:00:00"; d->address = strdup("00:00:00:00:00:00");
spa_bt_device_check_profiles(d, false); spa_bt_device_check_profiles(d, false);
d->reconnect_state = BT_DEVICE_RECONNECT_INIT; 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)) { if(spa_streq(remote_endpoint->uuid, SPA_BT_UUID_BAP_BROADCAST_SINK)) {
device = create_bcast_device(monitor, value); device = create_bcast_device(monitor, value);
if(device == NULL) {
goto next;
}
remote_endpoint->acceptor = true; remote_endpoint->acceptor = true;
device_set_connected(device, 1); device_set_connected(device, 1);
} else { } else {
@ -3495,6 +3495,7 @@ finish:
spa_log_error(monitor->log, "transport %p: transport_create_iso_io failed", spa_log_error(monitor->log, "transport %p: transport_create_iso_io failed",
transport); transport);
/* For broadcast there initiator moves the transport state to SPA_BT_TRANSPORT_STATE_ACTIVE */ /* 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) { if(transport->profile == SPA_BT_PROFILE_BAP_BROADCAST_SINK) {
spa_bt_transport_set_state(transport, SPA_BT_TRANSPORT_STATE_ACTIVE); spa_bt_transport_set_state(transport, SPA_BT_TRANSPORT_STATE_ACTIVE);
} else { } 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_SOURCE);
unregister_media_endpoint(monitor, codec, SPA_BT_MEDIA_SINK); 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); dbus_connection_unregister_object_path(monitor->conn, BAP_OBJECT_MANAGER_PATH);

View file

@ -1055,11 +1055,7 @@ static int emit_nodes(struct impl *this)
t = find_transport(this, SPA_BT_PROFILE_BAP_BROADCAST_SINK, this->props.codec); t = find_transport(this, SPA_BT_PROFILE_BAP_BROADCAST_SINK, this->props.codec);
if (t) { if (t) {
this->props.codec = t->media_codec->id; 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);
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);
} }
if (this->device_set.leader && this->device_set.sinks > 0) 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) { switch (profile) {
case SPA_BT_PROFILE_BAP_SINK: 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)"), desc_and_codec = spa_aprintf(_("High Fidelity Playback (BAP Sink, codec %s)"),
media_codec->description); media_codec->description);
break; break;
case SPA_BT_PROFILE_BAP_SOURCE: 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)"), desc_and_codec = spa_aprintf(_("High Fidelity Input (BAP Source, codec %s)"),
media_codec->description); media_codec->description);
break; break;
@ -1714,9 +1712,11 @@ static struct spa_pod *build_profile(struct impl *this, struct spa_pod_builder *
} else { } else {
switch (profile) { switch (profile) {
case SPA_BT_PROFILE_BAP_SINK: case SPA_BT_PROFILE_BAP_SINK:
case SPA_BT_PROFILE_BAP_BROADCAST_SINK:
desc = _("High Fidelity Playback (BAP Sink)"); desc = _("High Fidelity Playback (BAP Sink)");
break; break;
case SPA_BT_PROFILE_BAP_SOURCE: case SPA_BT_PROFILE_BAP_SOURCE:
case SPA_BT_PROFILE_BAP_BROADCAST_SOURCE:
desc = _("High Fidelity Input (BAP Source)"); desc = _("High Fidelity Input (BAP Source)");
break; break;
default: default: