Bluetooth: BAP: Add cc len check for BT_HCI_CODING_FORMAT_TRANSPARENT
When using BT_HCI_CODING_FORMAT_TRANSPARENT as the codec_id, the codec configuration (cc) len sent to the controller shall be 0. Since this goes for all devices, we ensure that we don't send invalid codec ID and cc data over air. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
7c1ec02933
commit
956a202ab8
|
@ -208,6 +208,14 @@ bool bt_audio_valid_codec_cfg(const struct bt_audio_codec_cfg *codec_cfg)
|
|||
}
|
||||
|
||||
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0
|
||||
/* Verify that codec configuration length is 0 when using
|
||||
* BT_HCI_CODING_FORMAT_TRANSPARENT as per the core spec, 5.4, Vol 4, Part E, 7.8.109
|
||||
*/
|
||||
if (codec_cfg->id == BT_HCI_CODING_FORMAT_TRANSPARENT && codec_cfg->data_len != 0) {
|
||||
LOG_DBG("Invalid data_len %zu for codec_id %u", codec_cfg->data_len, codec_cfg->id);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (codec_cfg->data_len > CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE) {
|
||||
LOG_DBG("codec_cfg->data_len (%zu) is invalid", codec_cfg->data_len);
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue