This implementation is a result of the following limitation: a BIS can't be added to an already established sync. To achieve this the old sync must be removed and a new one, with the new BIS included must be issued. To better explain the this implementation, I'll consider an example where the user wants to sync to BIS1 and BIS2 of the same BIG. First, he will run transport.select on transport_bis1. After the sync to this BIS is done, he will run transport.select on transport_bis2. As mentioned above, the old sync must be discarded and a new one issued. Thus, new sockets will be created for each BIS. The audio server must be made aware of these changes. So, on the receival of the second transport.select, BlueZ detects the ACTIVE transport_bis1, and calls bt_bap_stream_release on it's stream, which will call bap_bcast_release, thus setting the stream's state to RELEASING. This is detected by bap_state_changed, which calls transport_update_playing(transport_bis1, FALSE), prompting the audio server to release it. The release will trigger the stream's state to be changed to PENDING. It will also trigger the call of bap_stop_complete. Here, since the transport is PENDING, transport_update_playing(transport_bis1, TRUE) will be called, which will prompt the audio server to reacquire transport_bis1. Acquire calls result in a call to setup_accept_io_broadcast. Here, if no streams are in the RELEASING or PENDING state (meaning that they are waiting an acquire), the PA req is allocated. It's num_bis and bc_bis are set, are filled, based on streams in ENABLING state. From here, the sync request, with all the desired BISes will be sent to the kernel and then to the controller. Vlad Pruteanu (9): bap: Add helper function get_bis_from_stream bap: Drop union from bap_bcast_pa_req and add setups queue bap: Store sockaddr_iso_bc in bap_bcast_pa_req transport: Trigger transport release when syncing to multiple BISes shared/bap: Add guard for broadcast sink shared/bap: Add PENDING state for streams bap: Handle req to sync to multiple BISes bap: Update broadcast sink state machine transport: Trigger transport reacquire for multiple BISes sync profiles/audio/bap.c | 213 +++++++++++++++++++++++-------------- profiles/audio/transport.c | 56 +++++++++- src/shared/bap-defs.h | 1 + src/shared/bap.c | 18 +++- 4 files changed, 203 insertions(+), 85 deletions(-) -- 2.40.1