diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index c45717e..81e1fb0 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
free(req);
if (bt_bap_stream_set_io(setup->stream, fd)) {
- bt_bap_stream_start(setup->stream, NULL, NULL);
g_io_channel_set_close_on_unref(io, FALSE);
return;
}
if (!setup)
break;
if (old_state ==
- BT_BAP_STREAM_STATE_CONFIG)
- setup_create_io(data, setup, stream, defer);
- if (old_state ==
BT_BAP_STREAM_STATE_STREAMING)
setup_io_close(setup, NULL);
break;
+ case BT_BAP_STREAM_STATE_ENABLING:
+ /* For a Broadcast Sink, the ENABLING state suggests that
+ * the upper layer process requires the stream to start
+ * receiving audio. This state is used to differentiate
+ * between all configured streams and the ones that have
+ * been enabled by the upper layer. Create stream io.
+ */
+ setup_create_io(data, setup, stream, defer);
+ break;
}
}
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 17fedb3..b314b4b 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
bt_bap_stream_func_t func,
void *user_data)
{
- stream_set_state(stream, BT_BAP_STREAM_STATE_CONFIG);
+ stream_set_state(stream, BT_BAP_STREAM_STATE_ENABLING);
return 1;
}
diff --git a/unit/test-bap.c b/unit/test-bap.c
index 9cfc8c4..0c190d7 100644
--- a/unit/test-bap.c
+++ b/unit/test-bap.c
/* Enable stream */
bt_bap_stream_enable(stream, true, NULL, NULL, NULL);
- } else if (old_state == BT_BAP_STREAM_STATE_CONFIG) {
- /* Start stream */
- bt_bap_stream_start(stream, NULL, NULL);
} else {
/* Other state transitions are invalid */
tester_test_failed();
}
break;
+ case BT_BAP_STREAM_STATE_ENABLING:
+ /* Start stream */
+ bt_bap_stream_start(stream, NULL, NULL);
+ break;
case BT_BAP_STREAM_STATE_STREAMING:
queue_foreach(data->streams, stream_count_streaming, &num);