diff --git a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c index 474b8d0dbe9..b0eac97a80c 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_central_iso.c +++ b/subsys/bluetooth/controller/ll_sw/ull_central_iso.c @@ -147,7 +147,6 @@ uint8_t ll_cis_parameters_set(uint8_t cis_id, } /* TODO: - * - Drop retransmissions to stay within Max_Transmission_Latency instead of asserting * - Calculate ISO_Interval to allow SDU_Interval < ISO_Interval */ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) @@ -311,6 +310,8 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) } num_cis = cig->lll.num_cis; + +ll_cig_parameters_commit_retry: handle_iter = UINT16_MAX; /* 1) Acquire CIS instances and initialize instance data. @@ -520,8 +521,29 @@ uint8_t ll_cig_parameters_commit(uint8_t cig_id, uint16_t *handles) if (!cig->central.test) { /* Make sure specified Max_Transport_Latency is not exceeded */ - LL_ASSERT(c_latency <= cig->c_latency); - LL_ASSERT(p_latency <= cig->p_latency); + if ((c_latency > cig->c_latency) || (p_latency > cig->p_latency)) { + /* Check if we can reduce RTN to meet requested latency */ + if (!cis->central.c_rtn && !cis->central.p_rtn) { + /* Actual latency exceeds the Max. Transport Latency */ + err = BT_HCI_ERR_INVALID_PARAM; + + /* Release allocated resources and exit */ + goto ll_cig_parameters_commit_cleanup; + } + + /* Reduce the RTN to meet host requested latency. + * NOTE: Both central and peripheral retransmission is reduced for + * simplicity. + */ + if (cis->central.c_rtn) { + cis->central.c_rtn--; + } + if (cis->central.p_rtn) { + cis->central.p_rtn--; + } + + goto ll_cig_parameters_commit_retry; + } } c_max_latency = MAX(c_max_latency, c_latency); diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_i.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_i.sh index 1fac51ec6c2..0356cd0b594 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_i.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_i.sh @@ -46,5 +46,5 @@ Execute_AC_11_I 48_1_1 48_1_1 Execute_AC_11_I 48_2_1 48_2_1 Execute_AC_11_I 48_3_1 48_3_1 Execute_AC_11_I 48_4_1 48_4_1 -# Execute_AC_11_I 48_5_1 48_5_1 # ASSERTION FAIL [c_latency <= cig->c_latency] +Execute_AC_11_I 48_5_1 48_5_1 Execute_AC_11_I 48_6_1 48_6_1 diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_ii.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_ii.sh index 1908be1110b..c83bdc8c4be 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_ii.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_11_ii.sh @@ -50,5 +50,5 @@ Execute_AC_11_II 48_1_1 48_1_1 Execute_AC_11_II 48_2_1 48_2_1 Execute_AC_11_II 48_3_1 48_3_1 Execute_AC_11_II 48_4_1 48_4_1 -# Execute_AC_11_II 48_5_1 48_5_1 # Controller assert: ASSERTION FAIL [c_latency <= cig->c_latency] +Execute_AC_11_II 48_5_1 48_5_1 Execute_AC_11_II 48_6_1 48_6_1 diff --git a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_5.sh b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_5.sh index 33b186a7fc3..5eb9f6f5e30 100755 --- a/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_5.sh +++ b/tests/bsim/bluetooth/audio/test_scripts/cap_unicast_ac_5.sh @@ -46,4 +46,4 @@ Execute_AC_5 48_2_1 48_2_1 Execute_AC_5 48_3_1 48_3_1 Execute_AC_5 48_4_1 48_4_1 Execute_AC_5 48_5_1 48_5_1 -# Execute_AC_5 48_6_1 48_6_1 # ASSERTION FAIL [c_latency <= cig->c_latency] +Execute_AC_5 48_6_1 48_6_1