Skip to content

Bluetooth: BAP: Broadcast Sink should not keep reference to PA sync #95411

@Thalley

Description

@Thalley

Summary

struct bt_bap_broadcast_sink has a pa_sync reference, which is assigned when the broadcast sink is created via bt_bap_broadcast_sink_create.

However, the lifetime of a broadcast_sink and a pa_sync may differ; one may survive without the other, as the Broadcast Source may turn of PA while keeping the BIG alive.

If the PA sync is lost then the broadcast sink's pa_sync reference is lost, and there is no way to reattach a new pa_sync if the PA is later re-synced.

The pa_sync reference is only used when the broadcast sink attempts to sync to the BIG after bt_bap_broadcast_sink_create, and then for some lookups. The lookups are, however, refactored, as part of #95098 as we cannot use the address of the PA sync reliably as it may be an (N)RPA and thus change over time.

Describe the solution you'd like

Remove the pa_sync reference from struct bt_bap_broadcast_sink, and any uses of it.
The bt_bap_broadcast_sink_create should no longer tage a pa_sync as argument, but instead take the pa_sync as argument to bt_bap_broadcast_sink_sync where it is actually used.

This also means that the Broadcast Sink implementation can no longer update the BASS receive state PA sync state automatically, and must be done by the application.

Samples, tests, etc. will need to be updated, and an migration guide entry must be written.

Alternatives

Alternatively to avoid API changes, the struct bt_bap_broadcast_sink could keep the pa_sync reference but then add a new function like bt_bap_broadcast_sink_update_pa_sync which allow application to (re)attach a pa_sync reference to the broadcast sink. This will also keep the current behavior at the cost of the memory of keeping the reference in struct bt_bap_broadcast_sink

Additional Context

No response

Metadata

Metadata

Assignees

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions