[alsa-devel] snd_pcm_writei() return value
Jaroslav Kysela
perex at perex.cz
Thu May 21 20:08:34 CEST 2009
On Thu, 21 May 2009, Cristian Morales Vega wrote:
> while(buffer.length > 0) {
> snd_pcm_sframes_t written = snd_pcm_writei(device.handle,
> buffer_ptr, buffer.length);
> if(written < 0) {
> snd_pcm_recover(device.handle, written, 1);
> } else if(written <= buffer.length) {
> buffer.length -= written;
> buffer_ptr += written;
> }
> }
This is correct.
> ? And still, in this case an interrupt would be handled by
> snd_pcm_recover() (written < 0) or by the "else" code?
-EINTR is just noop in recover() function:
if (err == -EINTR) /* nothing to do, continue */
return 0;
Also check returned value from recover() - if it's negative, other error
occured.
Jaroslav
-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
More information about the Alsa-devel
mailing list