joba-1 / PicoW_A2DP

Bluetooth A2DP Sink to I2S/DAC on a Raspberry Pico W
8 stars 3 forks source link

Crashes with higher SBC bitrates #3

Open vulpes2 opened 7 months ago

vulpes2 commented 7 months ago

First of all thanks a lot for making this project, separating the application code with the SDK makes it so much easier to understand what's going on. I've been able to get this running with the Pico Audio Pack and it works really well as-is.

However, I've been trying to use higher non-default bitrates for SBC (SBC-XQ) and the application is just crashing. Attaching the debugger will sometimes make the audio garbled, and I can't seem to get a reliable backtrace for some reason. Do you happen to have any tips on how I can track down the issue? I'm using vscode with the cortex-debug extension, and a picoprobe.

joba-1 commented 7 months ago

Glad it helped you so far.

Better compression usually comes with higher resource usage. Maybe running out of memory, heap or stack? Unreliable debugging tools also point in this direction. Can you configure the codec to be more conservative on memory, at least to test the theory? Or just give it more stack? Other than that I probably can’t help much.

I always wanted to try another codec, not for bitrate but for lower latency. If you can make your project work I would love to see how this codec exchange is done…

vulpes2 commented 7 months ago

Adding additional codecs was exactly I had in mind, I thought I'd try to fix the SBC-XQ crashes first to get a better understanding of what's happening. I'll get to adding additional codecs at some point, it's probably easier to do this on a normal RPi and use btstack's a2dp demo as a base, then port it back to the pico w. Google seems to be using opus for their spatial audio stuff on Android, and that likely suggests opus is able to deliver lower latency compared to aac. Support for Google's version of the opus a2dp vendor codec has been added to pipewire recently and it should work out of the box.