[pulseaudio-discuss] Pulseaudio with Application Asterisk
Lennart Poettering
lennart at poettering.net
Fri Feb 15 14:10:12 PST 2008
On Thu, 14.02.08 20:10, Jim Duda (jim at duda.tzo.com) wrote:
>
> Here is the Asterisk alsa write code loop. I added the trap for -EIO.
> I'm getting an negative return from snd_pcm_recover.
>
> [Feb 14 20:08:25] ERROR[3085]: chan_alsa.c:404 alsa_write:
> snd_pcm_recover failed Input/output error
>
> Is there anything obvious which needs to be done to make this more pulse
> friendly?
Not sure. The general logic of snd_pcm_recover should be like this:
for (;;) {
if ((err = snd_pcm_writei(....)) >= 0)
/* Success */
break;
/* Failure, try to recover */
if ((err = snd_pcm_recover(..., err)) < 0) {
/* Failed to recover, we have a real issue */
fprintf(stderr, "Things went very wrong: %s", snd_strerror(err));
break;
}
/* Recovered, let's try another write */
}
This probably won't fix your issue, but it will shorten your code
quite a bit I would say and make it more robust.
snd_pcm_prepare() should be called only once after
init. snd_pcm_recover() will implicitly call _prepare() in all other
cases.
Lennart
--
Lennart Poettering Red Hat, Inc.
lennart [at] poettering [dot] net ICQ# 11060553
http://0pointer.net/lennart/ GnuPG 0x1A015CC4
More information about the pulseaudio-discuss
mailing list