-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
samples: Add Broadcast Assistant sample #68228
samples: Add Broadcast Assistant sample #68228
Conversation
cba5780
to
c2d6280
Compare
c2d6280
to
c72862a
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.
Looks generally really nice and clean! A few whitespace related coding style comments inline.
c72862a
to
11900a1
Compare
Thanks for reviewing! - I think I missed setting the right tab size in the editor. (also just pushed a small fix for nrf52840 - when using with the Samsung Galaxy Buds2 Pro, there is so much advertising data it seems ;) - but tested with both nrf5340 Audio DK/Zephyr hci_ipc + nrf52840 DK now) |
38af85b
to
b2a0769
Compare
samples/bluetooth/broadcast_assistant/boards/nrf52840dk_nrf52840.conf
Outdated
Show resolved
Hide resolved
I'll just add some printk logs here of this application running on an nRF5340 Audio DK against a Broadcast Audio Source (nRF52840 Dongle) and the Samsung Galaxy Buds2 Pro (broadcast audio plays just after that last line in the log):
Only change to config is:
|
b2a0769
to
261d6d2
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.
Nicely done for an initial sample. A few suggestions
Building for an nrf52840dk | ||
-------------------------- | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/bluetooth/broadcast_assistant/ | ||
:board: nrf52840dk_nrf52840 | ||
:goals: build |
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.
Have a look at https:/zephyrproject-rtos/zephyr/blob/main/samples/bluetooth/broadcast_audio_sink/README.rst?plain=1#L29-L80 and see if it makes sense to add similar (or the same) text here.
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.
as we don't need the extra support for actual ISO streams and because the sample is not power hungry enough to require an nRF5340, I decided it was not needed and also decided to use the nRF52840 as build example. If someone wants to run it on an nRF5340 device, the readme has a link to the bluetooth samples overview with the info on how to build hci_ipc.
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.
Nonetheless, we still probably want to build this for the nRF5340 ADK in CI, given that it's audio related, right? And the above sample also adds instructions on how to build it for that.
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.
Building for an nrf52840dk | |
-------------------------- | |
.. zephyr-app-commands:: | |
:zephyr-app: samples/bluetooth/broadcast_assistant/ | |
:board: nrf52840dk_nrf52840 | |
:goals: build | |
Building for an nrf52840dk | |
-------------------------- | |
.. zephyr-app-commands:: | |
:zephyr-app: samples/bluetooth/broadcast_assistant/ | |
:board: nrf52840dk_nrf52840 | |
:goals: build | |
Building for an nrf5340dk | |
------------------------- | |
You can build both the application core image and an appropriate controller image for the network | |
core with: | |
.. zephyr-app-commands:: | |
:zephyr-app: samples/bluetooth/broadcast_assistant/ | |
:board: nrf5340dk_nrf5340_cpuapp | |
:goals: build | |
:west-args: --sysbuild | |
If you prefer to only build the application core image, you can do so by doing instead: | |
.. zephyr-app-commands:: | |
:zephyr-app: samples/bluetooth/broadcast_assistant/ | |
:board: nrf5340dk_nrf5340_cpuapp | |
:goals: build | |
In that case you can pair this application core image with the | |
:ref:`hci_ipc sample <bluetooth-hci-ipc-sample>` | |
:zephyr_file:`samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf` configuration. | |
Building for a simulated nrf5340bsim | |
------------------------------------ | |
Similarly to how you would for real HW, you can do: | |
.. zephyr-app-commands:: | |
:zephyr-app: samples/bluetooth/broadcast_assistant/ | |
:board: nrf5340bsim_nrf5340_cpuapp | |
:goals: build | |
:west-args: --sysbuild | |
Note this will produce a Linux executable in `./build/zephyr/zephyr.exe`. | |
For more information, check :ref:`this board documentation <nrf5340bsim>`. | |
Is the "samples/bluetooth/broadcast_audio_sink/overlay-bt_ll_sw_split.conf" file need in this case?
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.
I can add instructions for how to build for nRF5340 Audio DK, but I'd prefer to add sysbuild & multiple targets in sample.yml in a subsequent PR, if that would be ok?
param.pa_interval = selected_pa_interval; | ||
param.broadcast_id = selected_broadcast_id; | ||
param.pa_sync = true; | ||
param.num_subgroups = 1; |
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.
Hardcoded value :)
Not sure what is valid to do here; e.g. if the source has 2 subgroups, can we just provide one?
BASS states
The Num_Subgroups field is used to expose the number of subgroups present in the Broadcast Audio Source Endpoint (BASE) structure, defined in Section 3.7.2.2 in [3], used to describe a BIG.
So I think we have to PA sync to the broadcast source to get the BASE to provide that value to the server, but the specs are actually a bit unclear on that.
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.
I think I will try with a few variants of sources today. Maybe it just takes the first one found/indexed if set to 1? I'll try with both the Samsung Galaxy Buds2 Pro and a board with this: #65014
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.
I don't currently have an easy way of testing with multiple subgroups. The current broadcast_audio_sample has one. Would this be a potential future improvement. Also, it would require doing the PA sync and more.
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.
Indeed. The question is whether this is valid behavior (a sample should not have known invalid behavior).
The way I read it, we need to sync to the PA for the BASE to get the subgroup count etc. (or even if is syncable). The current iteration of this sample is built on quite a few assumptions :D
Similarly a broadcast assistant should also verify that the sink can support the BASE before, but as discussed offline this isn't possible yet (#68283)
b955fb6
to
50c9182
Compare
844ea98
to
2bc497c
Compare
2bc497c
to
caa80d0
Compare
caa80d0
to
584119e
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.
A couple comments - adding a proper description to the sample would be my main request for change, the rest is not necessarily blocking but feels like it could be improved.
Thank you!
:name: Bluetooth: Broadcast Audio Assistant | ||
:relevant-api: bt_bap | ||
|
||
Bluetooth: Broadcast Audio Assistant |
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.
This is meant to be a short text description of the sample. It is recommended to word this as if you were completing the sentence "This code sample shows how to ..."). Not particularly fancy but maybe:
Bluetooth: Broadcast Audio Assistant | |
Use LE Broadcast Audio Assistant 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.
I'll go with that - can't come up with something more fancy atm. Also, I should add that we plan to extend the functionality during the next month to make it a more usable.
The sample will automatically try to connect to a device in the BAP Scan Delegator | ||
role (advertising support for the Broadcast Audio Scan Service (BASS)). | ||
It will then search for a broadcast source and (if found) add the broadcast ID to | ||
the BAP Scan Delegator. |
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.
Just a thought but this might sound a bit complex for someone not really familiar with or interested in the underlying concepts and yet willing to try this "audio broadcast" thing. Since it looks like you've been using with sample in a very practical way with e.g. earbuds, does it make sense to add another paragraph that describes how a user may practically give this a try? "A typical way of running this sample would be to ... ... blah blah earbuds ..." :)
Does that make sense?
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.
I think it makes sense, thanks
First version of Broadcast Assistant sample with hard coded selection of sink and source. Signed-off-by: Lars Knudsen <[email protected]>
584119e
to
707e114
Compare
@kartben, I just added your suggestions to the README file (only change in the last push) |
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.
Doc looks good, thank you!
Nit, maybe for a future update: I'm tend to be a sucker for including hyperlinks anywhere it makes sense, for better navigability/discoverability of the docs, and it would be nice to have actual links to the sink and source samples.
I can promise you that all broadcast audio samples will get some love and attention in the next weeks, where we will make sure to look at the docs too :) |
First version of Broadcast Assistant sample
with hard coded selection of sink and source.