Skip to content

Commit

Permalink
[nrf fromtree] Bluetooth: BAP: Broadcast sink: Clear pa_sync on PA te…
Browse files Browse the repository at this point in the history
…rminated

If the PA gets terminated, we clear the pa_sync field of the
corresponding broadcast sink object.

Signed-off-by: Emil Gydesen <[email protected]>
(cherry picked from commit c47b7f7)
Signed-off-by: Alexander Svensen <[email protected]>
  • Loading branch information
Thalley authored and rlubos committed Nov 6, 2023
1 parent b552226 commit 7a9d7da
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions subsys/bluetooth/audio/bap_broadcast_sink.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,16 @@ static void pa_recv(struct bt_le_per_adv_sync *sync,
bt_data_parse(buf, pa_decode_base, (void *)sink);
}

static void pa_term_cb(struct bt_le_per_adv_sync *sync,
const struct bt_le_per_adv_sync_term_info *info)
{
struct bt_bap_broadcast_sink *sink = broadcast_sink_get_by_pa(sync);

if (sink != NULL) {
sink->pa_sync = NULL;
}
}

static void update_recv_state_encryption(const struct bt_bap_broadcast_sink *sink)
{
struct bt_bap_scan_delegator_mod_src_param mod_src_param = { 0 };
Expand Down Expand Up @@ -1108,6 +1118,7 @@ static int broadcast_sink_init(void)
static struct bt_le_per_adv_sync_cb cb = {
.recv = pa_recv,
.biginfo = biginfo_recv,
.term = pa_term_cb,
};

bt_le_per_adv_sync_cb_register(&cb);
Expand Down

0 comments on commit 7a9d7da

Please sign in to comment.