I have a sound application that uses ALSA drivers for Linux, and the code works very well on an Intel Linux desktop machine. However, I would also like to support the Raspberry Pi, and I get periodic mutes and buffering on this platform. In fairness, it should be noted that problems also occur in Intel Linux, but they are not accompanied by unpleasant static bursts, which are probably associated with the ALSA driver on this platform.
In any case, I get two types of errors. First, my call to snd_pcm_wait() sometimes returns the -EPIPE code. I will catch this code and then try to call snd_pcm_recover() and then snd_pcm_prepare() , but the next time snd_pcm_writei() is called, some static distortion still occurs. Is this the right way to recover from such mistakes? Is there any way to recover from this without static?
When snd_pcm_wait() returns successfully, I call snd_pcm_avail_update() ... should I also do this after successfully returning from snd_pcm_recover() ?
The second problem is that sometimes snd_pcm_writei() also returns a -EPIPE return -EPIPE . Again, I try to call snd_pcm_recover() in this case, but still get audible clicks or other nasty things. Is there a way to extract more elegantly from this error?
source share