Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LE Audio: CAP and GMAP channel allocation fixes #67163

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions subsys/bluetooth/audio/shell/cap_initiator.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,10 @@ static int cap_ac_unicast_start(const struct bap_unicast_ac_param *param,
snk_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->snk_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

Expand All @@ -599,7 +602,10 @@ static int cap_ac_unicast_start(const struct bap_unicast_ac_param *param,
src_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->src_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

Expand Down
10 changes: 8 additions & 2 deletions tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,10 @@ static int cap_initiator_ac_cap_unicast_start(const struct cap_initiator_ac_para
snk_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->snk_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

Expand All @@ -1106,7 +1109,10 @@ static int cap_initiator_ac_cap_unicast_start(const struct cap_initiator_ac_para
src_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->src_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

Expand Down
24 changes: 20 additions & 4 deletions tests/bsim/bluetooth/audio/src/gmap_ugg_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,17 @@ static int gmap_ac_cap_unicast_start(const struct gmap_ac_param *param,
snk_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
bt_audio_codec_cfg_set_chan_allocation(
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->snk_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

if (err < 0) {
FAIL("Failed to set channel allocation: %d\n", err);
return err;
}
}
}

Expand All @@ -731,9 +739,17 @@ static int gmap_ac_cap_unicast_start(const struct gmap_ac_param *param,
src_stream_cnt++;
stream_cnt++;

if (param->conn_cnt > 1) {
bt_audio_codec_cfg_set_chan_allocation(
/* If we have more than 1 connection or stream in one direction, we set the
* location bit accordingly
*/
if (param->conn_cnt > 1U || param->src_cnt[i] > 1U) {
const int err = bt_audio_codec_cfg_set_chan_allocation(
stream_param->codec_cfg, (enum bt_audio_location)BIT(i));

if (err < 0) {
FAIL("Failed to set channel allocation: %d\n", err);
return err;
}
}
}
}
Expand Down
Loading