Skip to content

Commit 15c2b52

Browse files
alexsvenrlubos
authored andcommitted
samples: broadcast_config_tool: Add experimental tag
- Add config for broadcast_config_tool with experimental - OCT-3120 Signed-off-by: Alexander Svensen <[email protected]>
1 parent d1c13b2 commit 15c2b52

File tree

6 files changed

+21
-24
lines changed

6 files changed

+21
-24
lines changed

applications/nrf5340_audio/src/modules/lc3_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static void lc3_header_print(struct lc3_file_header *header)
2828
LOG_DBG("Num samples: %d", header->signal_len_lsb | (header->signal_len_msb << 16));
2929
}
3030

31-
int lc3_header_get(struct lc3_file_ctx *file, struct lc3_file_header *header)
31+
int lc3_header_get(struct lc3_file_ctx const *const file, struct lc3_file_header *header)
3232
{
3333
if ((file == NULL) || (header == NULL)) {
3434
LOG_ERR("Nullptr received");

applications/nrf5340_audio/src/modules/lc3_file.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct lc3_file_ctx {
4040
* @retval -EINVAL Invalid file context.
4141
* @retval 0 Success.
4242
*/
43-
int lc3_header_get(struct lc3_file_ctx *file, struct lc3_file_header *header);
43+
int lc3_header_get(struct lc3_file_ctx const *const file, struct lc3_file_header *header);
4444

4545
/**
4646
* @brief Get the next LC3 frame from the file.

applications/nrf5340_audio/src/modules/lc3_streamer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ int lc3_streamer_next_frame_get(const uint8_t streamer_idx, const uint8_t **cons
268268
return 0;
269269
}
270270

271-
bool lc3_streamer_file_header_verify(const char *const filename,
272-
const struct lc3_stream_cfg *const cfg)
271+
bool lc3_streamer_file_compatible_check(const char *const filename,
272+
const struct lc3_stream_cfg *const cfg)
273273
{
274274
int ret;
275275
bool result = true;

applications/nrf5340_audio/src/modules/lc3_streamer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ int lc3_streamer_next_frame_get(const uint8_t streamer_idx, const uint8_t **cons
4949
* @retval true Success.
5050
* @retval false Header is not matching the configuration.
5151
*/
52-
bool lc3_streamer_file_header_verify(const char *const filename,
53-
const struct lc3_stream_cfg *const cfg);
52+
bool lc3_streamer_file_compatible_check(const char *const filename,
53+
const struct lc3_stream_cfg *const cfg);
5454

5555
/**
5656
* @brief Register a new stream that will be played by the LC3 streamer.

samples/bluetooth/broadcast_config_tool/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ rsource "${ZEPHYR_NRF_MODULE_DIR}/applications/nrf5340_audio/src/utils/Kconfig"
1414
config TRANSPORT_BIS
1515
bool "Use BIS (Broadcast Isochronous Stream)"
1616

17+
config BROADCAST_CONFIG_TOOL
18+
bool "Broadcast Configuration Tool"
19+
depends on TRANSPORT_BIS
20+
select EXPERIMENTAL
21+
default y
22+
1723
menu "Logging"
1824

1925
module = MAIN

samples/bluetooth/broadcast_config_tool/src/main.c

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,40 +1646,31 @@ static int cmd_file_select(const struct shell *shell, size_t argc, char **argv)
16461646
struct bt_audio_codec_cfg *codec_cfg =
16471647
&broadcast_param[big_index].subgroups[sub_index].group_lc3_preset.codec_cfg;
16481648

1649-
int freq_hz = 0;
1649+
struct lc3_stream_cfg cfg;
16501650

1651-
ret = le_audio_freq_hz_get(codec_cfg, &freq_hz);
1651+
ret = le_audio_freq_hz_get(codec_cfg, &cfg.sample_rate_hz);
16521652
if (ret) {
16531653
shell_error(shell, "Failed to get frequency: %d", ret);
16541654
return ret;
16551655
}
16561656

1657-
int frame_duration = 0;
1658-
1659-
ret = le_audio_duration_us_get(codec_cfg, &frame_duration);
1657+
ret = le_audio_duration_us_get(codec_cfg, &cfg.frame_duration_us);
16601658
if (ret) {
16611659
shell_error(shell, "Failed to get frame duration: %d", ret);
16621660
}
16631661

1664-
uint32_t bit_rate = 0;
1665-
1666-
ret = le_audio_bitrate_get(codec_cfg, &bit_rate);
1662+
ret = le_audio_bitrate_get(codec_cfg, &cfg.bit_rate_bps);
16671663
if (ret) {
16681664
shell_error(shell, "Failed to get bitrate: %d", ret);
16691665
}
16701666

1671-
struct lc3_stream_cfg cfg = {
1672-
.sample_rate_hz = freq_hz,
1673-
.bit_rate_bps = bit_rate,
1674-
.frame_duration_us = frame_duration,
1675-
};
1676-
1677-
/* Verify the file header */
1667+
/* Verify that the file header matches the stream configurationn */
16781668
/* NOTE: This will not abort the streamer if the file is not valid, only give a warning */
1679-
bool result = lc3_streamer_file_header_verify(file_name, &cfg);
1669+
bool header_valid = lc3_streamer_file_compatible_check(file_name, &cfg);
16801670

1681-
if (!result) {
1682-
shell_warn(shell, "File header verification failed, continue at own risk");
1671+
if (!header_valid) {
1672+
shell_warn(shell, "File header verification failed. File may not be compatible "
1673+
"with stream config.");
16831674
}
16841675

16851676
ret = lc3_streamer_stream_register(

0 commit comments

Comments
 (0)