Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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.
The snd_pcm_recover() function handles more error codes, so you should use it.
But it ends up calling snd_pcm_prepare() anyway (see the source code).
There's nothing really special about snd_pcm_prepare(); it's just the simplest way of reinitializing the stream.
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.