-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth samples: Keep broadcast assistant connected #72409
Bluetooth samples: Keep broadcast assistant connected #72409
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things that needs a fix, a few things that needs a bit of formatting, but overall looks good.
@@ -107,6 +108,7 @@ static struct broadcast_sink_stream { | |||
} streams[CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT]; | |||
|
|||
static struct bt_bap_stream *streams_p[ARRAY_SIZE(streams)]; | |||
static bool stream_started; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should consider using the count of sem_stream_started
instead of a new bool. You can do k_sem_count_get(sem_stream_started)
to check if there are any streams started
You can also keep this, but then perhaps rename it to big_synced
and make it volatile or guard it with a mutex since you access it from multiple threads
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to wait for stream started. But k_sem_take(&sem_stream_started, SEM_TIMEOUT) sets it to zero and k_sem_count_get(sem_stream_started) no longer indicates whether streams are started
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will skip the wait for sem_stream_started and keep the old functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now waiting for stream connected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to wait for stream started. But k_sem_take(&sem_stream_started, SEM_TIMEOUT) sets it to zero and k_sem_count_get(sem_stream_started) no longer indicates whether streams are started
Indeed. Using semaphores for signaling is kind of a weird use of them :)
I've previously (several times) consider using https://docs.zephyrproject.org/latest/kernel/services/polling.html instead, but always felt that it was overkill
aae3cb4
to
f13e0d4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks OK, but some comments/questions left that I'd like to get resolved first
if (broadcast_assistant_conn == NULL) { | ||
k_sem_reset(&sem_connected); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setup
implies something you do once at the beginning.
Maybe we need to split this into 2 functions: 1 for the broadcast stuff, and 1 for the connection stuff?
f13e0d4
to
d83c28b
Compare
92893bd
to
294a951
Compare
When Broadcast Sink is connected to Broadcast Assistant then keep connection when Broadcast Source is removed. Signed-off-by: Jens Rehhoff Thomsen <jthm@demant.com>
294a951
to
9135d60
Compare
Jens has contributed the following PRs zephyrproject-rtos#68678 zephyrproject-rtos#72409 zephyrproject-rtos#72915 zephyrproject-rtos#73564 zephyrproject-rtos#73656 and is attending the weekly LE Audio Zephyr meetings. Signed-off-by: Lars Knudsen <larsgk@gmail.com>
Jens has contributed the following PRs zephyrproject-rtos#68678 zephyrproject-rtos#72409 zephyrproject-rtos#72915 zephyrproject-rtos#73564 zephyrproject-rtos#73656 and is attending the weekly LE Audio Zephyr meetings. Signed-off-by: Lars Knudsen <LAKD@Demant.com>
Jens has contributed the following PRs zephyrproject-rtos/zephyr#68678 zephyrproject-rtos/zephyr#72409 zephyrproject-rtos/zephyr#72915 zephyrproject-rtos/zephyr#73564 zephyrproject-rtos/zephyr#73656 and is attending the weekly LE Audio Zephyr meetings. (cherry picked from commit 0923750) Original-Signed-off-by: Lars Knudsen <LAKD@Demant.com> GitOrigin-RevId: 0923750 Change-Id: Ic57e788e2dc4d5ae0dbbb0687bb23657c6c9f8f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5629141 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
When Broadcast Sink is connected to Broadcast Assistant then keep connection when Broadcast Source is removed.