Message ID | 20241024110223.77254-5-iulia.tanasescu@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | bap: Add support for Broadcast Sink AC 13 | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | success | CheckPatch PASS |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
Hi Iulia, On Thu, Oct 24, 2024 at 7:03 AM Iulia Tanasescu <iulia.tanasescu@nxp.com> wrote: > > This updates the stream state transition from CONFIG to ENABLING, > on enable for Broadcast Sink streams. This is done to differentiate > between streams discovered in the BASE after short-lived PA sync > and streams that have been selected and enabled by the user. > --- > profiles/audio/bap.c | 7 +++---- > src/shared/bap.c | 2 +- > unit/test-bap.c | 7 ++++--- > 3 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c > index c45717ef2..4d250db52 100644 > --- a/profiles/audio/bap.c > +++ b/profiles/audio/bap.c > @@ -1020,7 +1020,6 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) > 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; > } > @@ -2676,13 +2675,13 @@ static void bap_state_bcast_sink(struct bt_bap_stream *stream, > case BT_BAP_STREAM_STATE_CONFIG: > 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; Since we are going with a state that is not documented in the spec for broadcast then we should document what it means internally so latter on someone don't assume it is a mistake or needs changing due to not adhering to the spec. > + case BT_BAP_STREAM_STATE_ENABLING: > + setup_create_io(data, setup, stream, defer); > + break; > } > } > > diff --git a/src/shared/bap.c b/src/shared/bap.c > index 46ed490d1..6a2e12577 100644 > --- a/src/shared/bap.c > +++ b/src/shared/bap.c > @@ -2186,7 +2186,7 @@ static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, > 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 9cfc8c403..0c190d7fe 100644 > --- a/unit/test-bap.c > +++ b/unit/test-bap.c > @@ -6419,14 +6419,15 @@ static void bsnk_state_str(struct bt_bap_stream *stream, uint8_t old_state, > > /* 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); > -- > 2.43.0 >
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index c45717ef2..4d250db52 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -1020,7 +1020,6 @@ static void iso_bcast_confirm_cb(GIOChannel *io, GError *err, void *user_data) 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; } @@ -2676,13 +2675,13 @@ static void bap_state_bcast_sink(struct bt_bap_stream *stream, case BT_BAP_STREAM_STATE_CONFIG: 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: + setup_create_io(data, setup, stream, defer); + break; } } diff --git a/src/shared/bap.c b/src/shared/bap.c index 46ed490d1..6a2e12577 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2186,7 +2186,7 @@ static unsigned int bap_bcast_sink_enable(struct bt_bap_stream *stream, 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 9cfc8c403..0c190d7fe 100644 --- a/unit/test-bap.c +++ b/unit/test-bap.c @@ -6419,14 +6419,15 @@ static void bsnk_state_str(struct bt_bap_stream *stream, uint8_t old_state, /* 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);