Merge branch 'bluez-per-adapter-config' into 'master'

bluez5: bap: add support for per adapter broadcast config

See merge request pipewire/pipewire!2677
This commit is contained in:
Alexander Sarmanow 2026-02-02 11:15:50 +00:00
commit 1a2e79a574
2 changed files with 23 additions and 0 deletions

View file

@ -1211,6 +1211,7 @@ PipeWire Opus Pro audio profile duplex max bitrate.
PipeWire Opus Pro audio profile duplex frame duration (1/10 ms).
@PAR@ monitor-prop bluez5.bcast_source.config = [] # JSON
For a per-adapter configuration of multiple BIGs use an "adapter" entry in the BIG with the HCI device name (e.g. hci0).
\parblock
Example:
```

View file

@ -194,6 +194,7 @@ struct spa_bt_bis {
};
#define BROADCAST_CODE_LEN 16
#define HCI_DEV_NAME_LEN 8
struct spa_bt_big {
struct spa_list link;
@ -202,6 +203,7 @@ struct spa_bt_big {
struct spa_list bis_list;
int big_id;
int sync_factor;
char adapter[HCI_DEV_NAME_LEN];
};
/*
@ -6244,8 +6246,20 @@ static void configure_bcast_source(struct spa_bt_monitor *monitor,
{
struct spa_bt_big *big;
struct spa_bt_bis *bis;
char *pos;
/* Configure each BIS from a BIG */
spa_list_for_each(big, &monitor->bcast_source_config_list, link) {
/* Apply per adapter configuration if BIG has an adapter value stated,
* otherwise apply the BIG config angnostically to each adapter
*/
if (strlen(big->adapter) > 0) {
pos = strstr(object_path, big->adapter);
if (pos == NULL)
continue;
spa_log_debug(monitor->log, "configuring BIG for adapter=%s", big->adapter);
}
spa_list_for_each(bis, &big->bis_list, link) {
configure_bis(monitor, codec, conn, object_path, interface_name,
big, bis, local_endpoint);
@ -6989,6 +7003,7 @@ static void parse_broadcast_source_config(struct spa_bt_monitor *monitor, const
char bis_key[256];
char qos_key[256];
char bcode[BROADCAST_CODE_LEN + 3];
char adapter[HCI_DEV_NAME_LEN + 3];
int cursor;
int big_id = 0;
struct spa_json it[3], it_array[4];
@ -7024,6 +7039,13 @@ static void parse_broadcast_source_config(struct spa_bt_monitor *monitor, const
goto parse_failed;
memcpy(big_entry->broadcast_code, bcode, strlen(bcode));
spa_log_debug(monitor->log, "big_entry->broadcast_code %s", big_entry->broadcast_code);
} else if (spa_streq(key, "adapter")) {
if (spa_json_get_string(&it[1], adapter, sizeof(adapter)) <= 0)
goto parse_failed;
if (strlen(adapter) > HCI_DEV_NAME_LEN)
goto parse_failed;
memcpy(big_entry->adapter, adapter, sizeof(adapter));
spa_log_debug(monitor->log, "big_entry->adapter %s", big_entry->adapter);
} else if (spa_streq(key, "encryption")) {
if (spa_json_get_bool(&it[0], &big_entry->encryption) <= 0)
goto parse_failed;