Skip to content

Commit cc5766b

Browse files
Thalleycarlescufi
authored andcommitted
tests: Bluetooth: Fix for btp_bap broadcast create/reconfig
This updates the struct name for the create parameter, and fixes the call to reconfig. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 3ffa1d5 commit cc5766b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tests/bluetooth/tester/src/btp_bap.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ static int setup_broadcast_source(uint8_t streams_per_subgroup, uint8_t subgroup
11731173
stream_params[CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT];
11741174
struct bt_bap_broadcast_source_subgroup_param
11751175
subgroup_param[CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT];
1176-
struct bt_bap_broadcast_source_create_param create_param;
1176+
struct bt_bap_broadcast_source_param create_param;
11771177

11781178
if (streams_per_subgroup * subgroups > CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT ||
11791179
subgroups > CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT) {
@@ -1203,11 +1203,20 @@ static int setup_broadcast_source(uint8_t streams_per_subgroup, uint8_t subgroup
12031203
LOG_DBG("Creating broadcast source with %zu subgroups with %zu streams",
12041204
subgroups, subgroups * streams_per_subgroup);
12051205

1206-
err = bt_bap_broadcast_source_create(&create_param, source);
1207-
if (err != 0) {
1208-
LOG_DBG("Unable to create broadcast source: %d", err);
1206+
if (*source == NULL) {
1207+
err = bt_bap_broadcast_source_create(&create_param, source);
1208+
if (err != 0) {
1209+
LOG_DBG("Unable to create broadcast source: %d", err);
12091210

1210-
return err;
1211+
return err;
1212+
}
1213+
} else {
1214+
err = bt_bap_broadcast_source_reconfig(*source, &create_param);
1215+
if (err != 0) {
1216+
LOG_DBG("Unable to reconfig broadcast source: %d", err);
1217+
1218+
return err;
1219+
}
12111220
}
12121221

12131222
return 0;
@@ -1247,14 +1256,7 @@ static uint8_t broadcast_source_setup(const void *cmd, uint16_t cmd_len,
12471256
broadcaster->qos.pd = sys_get_le24(cp->presentation_delay);
12481257
broadcaster->qos.sdu = sys_le16_to_cpu(cp->max_sdu);
12491258

1250-
if (broadcast_source == NULL) {
1251-
err = setup_broadcast_source(cp->streams_per_subgroup, cp->subgroups,
1252-
&broadcast_source);
1253-
} else {
1254-
err = bt_bap_broadcast_source_reconfig(broadcast_source, &broadcaster->codec_cfg,
1255-
&broadcaster->qos);
1256-
}
1257-
1259+
err = setup_broadcast_source(cp->streams_per_subgroup, cp->subgroups, &broadcast_source);
12581260
if (err != 0) {
12591261
LOG_DBG("Unable to setup broadcast source: %d", err);
12601262

0 commit comments

Comments
 (0)