Bluetooth: Audio: Add packing field to broadcast source

Add support for setting the ISO packing field when
creating a broadcast source.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-12-20 15:39:07 +01:00 committed by Carles Cufí
commit ba1949759d
4 changed files with 19 additions and 1 deletions

View file

@ -2052,6 +2052,15 @@ struct bt_audio_broadcast_source_create_param {
/** Quality of Service configuration. */
struct bt_codec_qos *qos;
/** @brief Broadcast Source packing mode.
*
* @ref BT_ISO_PACKING_SEQUENTIAL or @ref BT_ISO_PACKING_INTERLEAVED.
*
* @note This is a recommendation to the controller, which the
* controller may ignore.
*/
uint8_t packing;
};
/** @brief Create audio broadcast source.

View file

@ -532,6 +532,12 @@ static bool valid_create_param(const struct bt_audio_broadcast_source_create_par
return false;
}
CHECKIF(param->packing != BT_ISO_PACKING_SEQUENTIAL &&
param->packing != BT_ISO_PACKING_INTERLEAVED) {
LOG_DBG("param->packing %u is invalid", param->packing);
return false;
}
qos = param->qos;
CHECKIF(qos == NULL) {
LOG_DBG("param->qos is NULL");
@ -727,6 +733,7 @@ int bt_audio_broadcast_source_create(struct bt_audio_broadcast_source_create_par
}
}
source->qos = qos;
source->packing = param->packing;
LOG_DBG("Broadcasting with ID 0x%6X", source->broadcast_id);
@ -873,7 +880,7 @@ int bt_audio_broadcast_source_start(struct bt_audio_broadcast_source *source,
param.num_bis = bis_count;
param.bis_channels = bis;
param.framing = source->qos->framing;
param.packing = 0; /* TODO: Add to QoS struct */
param.packing = source->packing;
param.interval = source->qos->interval;
param.latency = source->qos->latency;

View file

@ -77,6 +77,7 @@ struct bt_audio_broadcast_stream_data {
struct bt_audio_broadcast_source {
uint8_t stream_count;
uint8_t packing;
uint32_t broadcast_id; /* 24 bit */
struct bt_iso_big *big;

View file

@ -127,6 +127,7 @@ static int setup_broadcast_source(struct bt_audio_broadcast_source **source)
create_param.params_count = ARRAY_SIZE(subgroup_params);
create_param.params = subgroup_params;
create_param.qos = &preset_16_2_2.qos;
create_param.packing = BT_ISO_PACKING_SEQUENTIAL;
printk("Creating broadcast source with %zu subgroups and %zu streams\n",
ARRAY_SIZE(subgroup_params), ARRAY_SIZE(stream_params));