Bluetooth: Audio: Add fallback to get_chan_allocation

Added a fallback parameter to
bt_audio_codec_cfg_get_chan_allocation as absence of
channel allocation in BAP implicitly means Mono.
In the case that it is absent,
BT_AUDIO_LOCATION_MONO_AUDIO is the returned value.

This commit also fixes the implementation of
bt_audio_codec_cfg_get_frame_blocks_per_sdu as it only applies to
LC3 (as per the BAP spec). It also adds additional testing of it

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-05-10 13:50:16 +02:00 committed by Anas Nashif
commit c6cc034b5c
14 changed files with 157 additions and 60 deletions

View file

@ -134,7 +134,7 @@ static bool valid_base_subgroup(const struct bt_bap_base_subgroup *subgroup)
return false;
}
ret = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation);
ret = bt_audio_codec_cfg_get_chan_allocation(&codec_cfg, &chan_allocation, false);
if (ret == 0) {
chan_cnt = bt_audio_get_chan_count(chan_allocation);
} else {
@ -444,7 +444,7 @@ static void validate_stream_codec_cfg(const struct bt_bap_stream *stream)
/* The broadcast source sets the channel allocation in the BIS to
* BT_AUDIO_LOCATION_FRONT_LEFT
*/
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation);
ret = bt_audio_codec_cfg_get_chan_allocation(codec_cfg, &chan_allocation, false);
if (ret == 0) {
if (chan_allocation != BT_AUDIO_LOCATION_FRONT_LEFT) {
FAIL("Unexpected channel allocation: 0x%08X", chan_allocation);