Skip to content

Commit 8b035b7

Browse files
pvVudentz
authored andcommitted
bap: handle state transitions with old_state == new_state
ASCS allows transitions from Codec/QoS Configured back to the same state. E.g. NRF5340_AUDIO devkit starts in the config(1) state, which is allowed (only Config QoS, Release, Enable, Receiver Stop Ready transition are client-only). In this case, as client, we do Config Codec ourselves and end up with config(1)->config(1) transition. We currently ignore that event, so QoS won't be setup and transports won't be created. Handle the config(1)->config(1) transition by continuing to Config QoS if it occurs. Log: src/gatt-client.c:btd_gatt_client_connected() Device connected. src/shared/gatt-client.c:exchange_mtu_cb() MTU exchange complete, with MTU: 65 src/shared/bap.c:bap_ep_set_status() ASE status: ep 0x604000039a90 id 0x01 handle 0x000f state config len 42 src/shared/bap.c:ep_status_config() codec 0x06 framing 0x00 phy 0x02 rtn 2 latency 10 pd 4000 - 40000 ppd 4000 - 40000 src/shared/bap.c:ep_status_config() Codec Config #0: type 0x01 len 2 src/shared/bap.c:ep_status_config() Codec Config ruundii#1: type 0x02 len 2 src/shared/bap.c:ep_status_config() Codec Config bluez#2: type 0x03 len 5 src/shared/bap.c:ep_status_config() Codec Config bluez#3: type 0x04 len 3 src/shared/bap.c:ep_status_config() Codec Config bluez#4: type 0x05 len 2 src/shared/bap.c:bap_stream_state_changed() stream 0x60c0000334c0 dir 0x01: idle -> config src/shared/bap.c:bap_stream_update_io_links() stream 0x60c0000334c0 profiles/audio/bap.c:bap_state() stream 0x60c0000334c0: idle(0) -> config(1) profiles/audio/bap.c:bap_ready() bap 0x60e000001d20 profiles/audio/bap.c:pac_found() lpac 0x608000017520 rpac 0x6080000183a0 profiles/audio/bap.c:ep_register() ep 0x60d000006910 lpac 0x608000017520 rpac 0x6080000183a0 path /org/bluez/hci0/dev_C9_C9_76_21_08_4F/pac_sink0 profiles/audio/media.c:media_endpoint_async_call() Calling SelectProperties: name = :1.604 path = /MediaEndpointLE/BAPSource/lc3 ... src/shared/bap.c:bap_stream_state_changed() stream 0x60c0000334c0 dir 0x01: config -> config src/shared/bap.c:bap_stream_update_io_links() stream 0x60c0000334c0 profiles/audio/bap.c:bap_state() stream 0x60c0000334c0: config(1) -> config(1)
1 parent 14dd4a7 commit 8b035b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

profiles/audio/bap.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1887,7 +1887,11 @@ static void bap_state(struct bt_bap_stream *stream, uint8_t old_state,
18871887
bt_bap_stream_statestr(old_state), old_state,
18881888
bt_bap_stream_statestr(new_state), new_state);
18891889

1890-
if (new_state == old_state)
1890+
/* Ignore transitions back to same state (ASCS allows some of these).
1891+
* Of these we need to handle only the config->config case, which will
1892+
* occur when reconfiguring the codec from initial config state.
1893+
*/
1894+
if (new_state == old_state && new_state != BT_BAP_STREAM_STATE_CONFIG)
18911895
return;
18921896

18931897
ep = bap_find_ep_by_stream(data, stream);

0 commit comments

Comments
 (0)