This patch refactors the flow for the BAP Broadcast Sink. After observing the BASE information, streams and transports will be generated for each BIS that matches local PAC capabilities. Because endpoints are not available any more, local PAC (which contain local registered capabilities) has a new list of setups. Each setup is generated based on the matching BIS observed. Then, the setup is used to configure a stream which then generates a MediaTransport. The transport is in the TRANSPORT_STATE_IDLE state until someone acquires it. The "Acquire" procedure results in creating the IO using BIG Create Sync. The successful reply of it causes the transport to be advanced in TRANSPORT_STATE_ACTIVE state. bluetoothctl log with two transports being created and acquired: endpoint.register 00001851-0000-1000-8000-00805f9b34fb 0x06 [/local/endpoint/ep0] Auto Accept (yes/no): y [/local/endpoint/ep0] Max Transports (auto/value): a [/local/endpoint/ep0] Locations: 3 [/local/endpoint/ep0] Supported Context (value): 3 Capabilities: 03 01 ff 00 02 02 03 02 03 03 05 04 1a 00 f0 00 ................ Metadata: [bluetooth]# Endpoint /local/endpoint/ep0 registered scan le [bluetooth]# SetDiscoveryFilter success [bluetooth]# hci7 type 6 discovering on [bluetooth]# Discovery started [bluetooth]# [CHG] Controller 00:60:37:A6:AE:22 Discovering: yes [bluetooth]# [NEW] Device 07:34:BB:4B:6F:C3 07-34-BB-4B-6F-C3 [bluetooth]# hci7 07:34:BB:4B:6F:C3 type LE Random connected eir_len 0 [bluetooth]# [NEW] Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis1/ fd0 [bluetooth]# Endpoint: SetConfiguration [bluetooth]# Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis1/fd0 [bluetooth]# Properties.Device: /org/bluez/hci7/dev_07_34_BB_4B_6F_C3 [bluetooth]# Auto Accepting... [bluetooth]# [NEW] Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis2/ fd1 [bluetooth]# Endpoint: SetConfiguration [bluetooth]# Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis2/fd1 [bluetooth]# Properties.Device: /org/bluez/hci7/dev_07_34_BB_4B_6F_C3 [bluetooth]# Auto Accepting... [CHG] Device 07:34:BB:4B:6F:C3 Connected: yes [07-34-BB-4B-6F-C3]# transport.acquire /org/bluez/hci7/ dev_07_34_BB_4B_6F_C3/bis1/fd0 auto acquiring... Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis1/fd0 acquiring [07-34-BB-4B-6F-C3]# hci7 07:34:BB:4B:6F:C3 type LE Random connected eir_len 0 [07-34-BB-4B-6F-C3]# hci7 07:34:BB:4B:6F:C3 type LE Random connected eir_len 0 [07-34-BB-4B-6F-C3]# Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/ bis1/fd0 acquiring complete [07-34-BB-4B-6F-C3]# Acquire successful: fd 8 MTU 40:0 [07-34-BB-4B-6F-C3]# [CHG] Transport /org/bluez/hci7/ dev_07_34_BB_4B_6F_C3/bis1/fd0 State: active hci7 type 6 discovering offm[seq 0] recv: 0 bytes # 1 hci7 type 6 discovering on9m[seq 146] recv: 0 bytes # 7 hci7 type 6 discovering offm[seq 149] recv: 0 bytes # 50 hci7 type 6 discovering on [seq 2446] recv: 0 bytes #transport.release /org/bluez/hci7/ dev_07_34_BB_4B_6F_C3/bis1/fd0 [07-34-BB-4B-6F-C3]# [CHG] Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3 /bis1/fd0 State: idle [07-34-BB-4B-6F-C3]# Release successful [07-34-BB-4B-6F-C3]# transport.acquire /org/bluez/hci7/ dev_07_34_BB_4B_6F_C3/bis2/fd1 auto acquiring... Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis2/fd1 acquiring [07-34-BB-4B-6F-C3]# hci7 07:34:BB:4B:6F:C3 type LE Random connected eir_len 0 [07-34-BB-4B-6F-C3]# hci7 07:34:BB:4B:6F:C3 type LE Random connected eir_len 0 [07-34-BB-4B-6F-C3]# Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3/bis2 /fd1 acquiring complete [07-34-BB-4B-6F-C3]# Acquire successful: fd 9 MTU 40:0 [07-34-BB-4B-6F-C3]# [CHG] Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3 /bis2/fd1 State: active hci7 type 6 discovering off hci7 type 6 discovering on [seq 1330] recv: 0 bytes #transport.release /org/bluez/hci7/ dev_07_34_BB_4B_6F_C3/bis2/fd1 [07-34-BB-4B-6F-C3]# 1;39m[seq 1331] recv: 0 bytes #Transport fd disconnected [07-34-BB-4B-6F-C3]# [CHG] Transport /org/bluez/hci7/dev_07_34_BB_4B_6F_C3 /bis2/fd1 State: idle [07-34-BB-4B-6F-C3]# Release successful The difference from v2 patch is that match_data is not initialized any more, to overcome scan-build warning: warning: Value stored to 'match_data' during its initialization is never read struct bt_ltv_match match_data = {0}. Andrei Istodorescu (2): shared/bap: Update stream management to avoid PACs bap: Create transports for matching BISes profiles/audio/bap.c | 323 ++++++++++++++++++++++++++++++------------- src/shared/bap.c | 290 ++++++++++++++++++-------------------- src/shared/bap.h | 6 +- 3 files changed, 363 insertions(+), 256 deletions(-) base-commit: c7445d9736947163f0028bae0fd1ae2133bbbdbe -- 2.40.1