From: Yang Li <yang.li@xxxxxxxxxxx> This change ensures cb->handle is executed even if the function returns early in the attribute_notify section. It also allows the stream status to be updated before notifying the client, improving efficiency. --- src/shared/bass.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/shared/bass.c b/src/shared/bass.c index 7b9e0da63..11ad59e3b 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -964,6 +964,20 @@ static void bass_handle_set_bcast_code_op(struct bt_bass *bass, gatt_db_attribute_write_result(attrib, id, 0x00); + for (entry = queue_get_entries(bass->cp_handlers); entry; + entry = entry->next) { + struct bt_bass_cp_handler *cb = entry->data; + + if (cb->handler) { + ret = cb->handler(bcast_src, + BT_BASS_SET_BCAST_CODE, + params, cb->data); + if (ret) + DBG(bass, "Unable to handle Set " + "Broadcast Code operation"); + } + } + if (!bass_trigger_big_sync(bcast_src)) { bcast_src->enc = BT_BASS_BIG_ENC_STATE_DEC; @@ -977,21 +991,6 @@ static void bass_handle_set_bcast_code_op(struct bt_bass *bass, free(notif->iov_base); free(notif); - return; - } - - for (entry = queue_get_entries(bass->cp_handlers); entry; - entry = entry->next) { - struct bt_bass_cp_handler *cb = entry->data; - - if (cb->handler) { - ret = cb->handler(bcast_src, - BT_BASS_SET_BCAST_CODE, - params, cb->data); - if (ret) - DBG(bass, "Unable to handle Set " - "Broadcast Code operation"); - } } } -- 2.42.0