Describe the bug
When running a2dp_sink_demo on RK3308, an error occurs after pausing and then resuming the music.
Error message: Error storing samples in SBC ring buffer!!!
To Reproduce
Steps to reproduce the behavior:
- Run example 'a2dp_sink_demo' on RK3308
- Connect to device 'iPhone17'
- Playing music on an iPhone 17, the RK3308 can output sound
- Paused on the iPhone 17, the RK3308 outputs no sound
- Waiting for the RK3308 terminal to output "A2DP Sink : Stream paused"
- Resumes on the iPhone 17, the RK3308 terminal displays an error message. Error storing samples in SBC ring buffer!!!
Expected behavior
Playback can be resumed normally.
HCI Packet Logs
hci_dump_a2dp_sink_demo.tar.gz
Additional context
My investigation revealed that adding a call to the snd_pcm_prepare() function within the alsa_stop_stream() function in the btstack_audio_alsa.c file resolved the issue.
The modified function is as follows
static void alsa_stop_stream(void) {
snd_pcm_drop(pcm_handle);
snd_pcm_prepare(pcm_handle); // add
}