I am using ASLA Audio API for playing sound in my embedded linux application. Am observing at times that the snd_pcm_writei
API returns –EPIPE
error and when that error happens I call snd_pcm_prepare
(that basically prepares PCM for re-use).
if ((err = snd_pcm_writei (playback_handle, buf, nframes)) < 0)
{
if ((err = snd_pcm_prepare (playback_handle)) < 0)
return err;
}
I found some suggestions that instead of snd_pcm_prepare
using snd_pcm_recover
should be the correct approach in this instance. Before trying the fix I just wanted to know if anybody can help me out in understanding how we to set the PCM device to recover from the underrun or other errors that can happen during write.