alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* snd_pcm_writei returns -EAGAIN after poll
@ 2011-03-20  2:21 Ivan Sorokin
  2011-03-20  2:40 ` Raymond Yau
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Sorokin @ 2011-03-20  2:21 UTC (permalink / raw)
  To: alsa-devel

Hello!

I use slightly modified test/pcm.c in write_and_poll mode.

My program looks like this:

snd_pcm_open with SND_PCM_NONBLOCK
snd_pcm_set_params

infinite loop
    poll for snd_pcm_poll_descriptors
    snd_pcm_poll_descriptors_revents
    if POLLOUT flag is set
       snd_pcm_writei

Everything works, but snd_pcm_writei sometimes returns -EAGAIN. The 
probability of when snd_pcm_writei returns -EAGAIN depends on buffer 
size that I pass to it. ExperimentallyI found out that when I call 
snd_pcm_writei with 940 bytes buffers (maybe something related to period 
size?) it never returns -EAGAIN.

Why poll returns when there is no place for new data? Is it ok to ignore 
EAGAIN and just start another poll? Is there any recommended buffer size 
for snd_pcm_writei?

My test program: 
https://github.com/sorokin/asoundpp/blob/master/sine_async.cpp (94 LOC)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-20  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-20  2:21 snd_pcm_writei returns -EAGAIN after poll Ivan Sorokin
2011-03-20  2:40 ` Raymond Yau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).