Skip to content
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: USB Audio Starvation in BAP Broadcast Sink Sample #76551

Closed
smaerup opened this issue Jul 31, 2024 · 13 comments
Closed

Bluetooth: USB Audio Starvation in BAP Broadcast Sink Sample #76551

smaerup opened this issue Jul 31, 2024 · 13 comments
Assignees
Labels
area: Bluetooth Audio area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@smaerup
Copy link
Contributor

smaerup commented Jul 31, 2024

Describe the bug
The bap_broadcast_sink sample app will not send any audio frames over USB if no audio is received from the broadcast source.
This can cause issues on USB host side as some audio implementations does not like to be starved of audio frames. Particularly the Java audio implementation fails when trying to stop an audio recording from a device that has not yet provided any audio frames.

To Reproduce

  1. Build the bap_broadcast_sink sample app and download to a nRF5340 Audio DK board
  2. Connect to a Linux Host and start a recording using the Java Audio framework.
  3. Stop the recording without having received any audio frames from a broadcast source.
  4. The Java Audio framework will then hang as it has not yet received any USB audio frames.

Expected behavior
When stopping a recording from a device which has not yet received any audio, the recording should be successfully stopped and an audio file containing only silence should be produced.

Environment
OS: (Linux)
Toolchain (Zephyr SDK, Java SDK)
Commit origin/main 36940db

@smaerup smaerup added the bug The issue is a bug, or the PR is fixing a bug label Jul 31, 2024
Copy link

Hi @smaerup! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

@aescolar
Copy link
Member

@smaerup would you be so kind as to elaborate a bit more :)

@Thalley
Copy link
Collaborator

Thalley commented Jul 31, 2024

@smaerup would you be so kind as to elaborate a bit more :)

@smaerup Please follow the bug template and properly describe the issue

@jhedberg jhedberg added the priority: low Low impact/importance bug label Aug 6, 2024
@smaerup
Copy link
Contributor Author

smaerup commented Aug 29, 2024

Sorry for the delay, just came back from vacation.

@Thalley
Copy link
Collaborator

Thalley commented Sep 10, 2024

@smaerup Any updates on this?

@smaerup
Copy link
Contributor Author

smaerup commented Sep 10, 2024

@Thalley I updated the bug description 2 weeks ago, anything else required?

@Thalley
Copy link
Collaborator

Thalley commented Sep 10, 2024

@Thalley I updated the bug description 2 weeks ago, anything else required?

Ah, sorry, didn't notice that :)

Have you tried with anything besides the Java Audio framework?

Just want to make sure that the issue is in Zephyr, and not that framework, as I haven't experienced issues when using e.g. pipewire.

@smaerup
Copy link
Contributor Author

smaerup commented Sep 10, 2024

Yes, tried it with both plain Linux & Windows, and there the failure to stop an audio recording does not occur.
But not sending "silent" USB audio frames causes another issue on plain Linux/Windows that at first confused me a bit.
If I start a recording on the USB host and then some time later start/stop a BIS stream a few times, I would then expect the resulting recording to contain:
Silence, Audio, Silence Audio, Silence
But since no USB frames where sent, the resulting recording ended up being:
Audio, Audio

@Thalley
Copy link
Collaborator

Thalley commented Sep 10, 2024

Yes, tried it with both plain Linux & Windows, and there the failure to stop an audio recording does not occur. But not sending "silent" USB audio frames causes another issue on plain Linux/Windows that at first confused me a bit. If I start a recording on the USB host and then some time later start/stop a BIS stream a few times, I would then expect the resulting recording to contain: Silence, Audio, Silence Audio, Silence But since no USB frames where sent, the resulting recording ended up being: Audio, Audio

Okay, so the issue seems to be that the sample is not sending empty USB frames to the host when there's no BIS?

@smaerup
Copy link
Contributor Author

smaerup commented Oct 15, 2024

Sorry, was away on vacation.
Yes, that describes the issue very well.

@Thalley
Copy link
Collaborator

Thalley commented Oct 16, 2024

Great, then we have a pretty good idea of what the issue is and where to look for at fix.

Could you provide the steps to use the Java Audio framework to reproduce the issue? I'm unfamiliar with that framework, and I don't want to spend too much time with that framework to replicate the issue and to verify it.

@smaerup
Copy link
Contributor Author

smaerup commented Oct 21, 2024

The problem as such is already fixed by PR #76270
So this bug report is just for linking to the 3.7 backport.

@Thalley
Copy link
Collaborator

Thalley commented Oct 21, 2024

This was fixed by #76270 and backported by #76548

@Thalley Thalley closed this as completed Oct 21, 2024
@github-project-automation github-project-automation bot moved this from To do to Done in Bluetooth LE Audio Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Audio area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
Status: Done
Development

No branches or pull requests

4 participants