Skip to content

Commit e793786

Browse files
Thalleycvinayak
authored andcommitted
[nrf fromtree] Bluetooth: BAP: Add support for transparent coding format
Add support for controlling whether the local controller should transcode, or whether it will be done by another module (e.g. the host). By default when using the macros, controller transcoding will be disabled. Signed-off-by: Emil Gydesen <[email protected]> (cherry picked from commit 1faa5a2) Signed-off-by: Jui-Chou Chung <[email protected]>
1 parent 0c16a9a commit e793786

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

Diff for: include/zephyr/bluetooth/audio/audio.h

+14
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ enum bt_audio_metadata_type {
209209
((struct bt_audio_codec_cfg){ \
210210
/* Use HCI data path as default, can be overwritten by application */ \
211211
.path_id = BT_ISO_DATA_PATH_HCI, \
212+
.ctlr_transcode = false, \
212213
.id = _id, \
213214
.cid = _cid, \
214215
.vid = _vid, \
@@ -231,6 +232,7 @@ enum bt_audio_metadata_type {
231232
((struct bt_audio_codec_cap){ \
232233
/* Use HCI data path as default, can be overwritten by application */ \
233234
.path_id = BT_ISO_DATA_PATH_HCI, \
235+
.ctlr_transcode = false, \
234236
.id = (_id), \
235237
.cid = (_cid), \
236238
.vid = (_vid), \
@@ -316,6 +318,12 @@ struct bt_audio_codec_cap {
316318
* vendor specific ID.
317319
*/
318320
uint8_t path_id;
321+
/** Whether or not the local controller should transcode
322+
*
323+
* This effectively sets the coding format for the ISO data path to @ref
324+
* BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id.
325+
*/
326+
bool ctlr_transcode;
319327
/** Codec ID */
320328
uint8_t id;
321329
/** Codec Company ID */
@@ -344,6 +352,12 @@ struct bt_audio_codec_cfg {
344352
* vendor specific ID.
345353
*/
346354
uint8_t path_id;
355+
/** Whether or not the local controller should transcode
356+
*
357+
* This effectively sets the coding format for the ISO data path to @ref
358+
* BT_HCI_CODING_FORMAT_TRANSPARENT if false, else uses the @ref bt_audio_codec_cfg.id.
359+
*/
360+
bool ctlr_transcode;
347361
/** Codec ID */
348362
uint8_t id;
349363
/** Codec Company ID */

Diff for: subsys/bluetooth/audio/bap_stream.c

+16-6
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,22 @@ void bt_audio_codec_cfg_to_iso_path(struct bt_iso_chan_path *path,
3535
struct bt_audio_codec_cfg *codec_cfg)
3636
{
3737
path->pid = codec_cfg->path_id;
38-
path->format = codec_cfg->id;
39-
path->cid = codec_cfg->cid;
40-
path->vid = codec_cfg->vid;
41-
path->delay = 0; /* TODO: Add to bt_audio_codec_cfg? Use presentation delay? */
42-
path->cc_len = codec_cfg->data_len;
43-
path->cc = codec_cfg->data;
38+
39+
if (codec_cfg->ctlr_transcode) {
40+
path->format = codec_cfg->id;
41+
path->cid = codec_cfg->cid;
42+
path->vid = codec_cfg->vid;
43+
path->delay = 0;
44+
path->cc_len = codec_cfg->data_len;
45+
path->cc = codec_cfg->data;
46+
} else {
47+
path->format = BT_HCI_CODING_FORMAT_TRANSPARENT;
48+
path->cid = 0;
49+
path->vid = 0;
50+
path->delay = 0;
51+
path->cc_len = 0;
52+
path->cc = NULL;
53+
}
4454
}
4555

4656
#if defined(CONFIG_BT_BAP_UNICAST_CLIENT) || defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || \

0 commit comments

Comments
 (0)