[alsa-devel] Problems with nonblocking capture every 20ms

Jaroslav Kysela perex at perex.cz
Mon Mar 10 19:38:50 CET 2008


On Mon, 10 Mar 2008, Johannes Dohmen wrote:

> Hi there,
> 
> With a sampling rate of 8000 I want to capture every 20ms a chunk (160 
> frames) of data from the soundcard. That works ok, but every ~5 seconds 
> I get a EGAIN from snd_pcm_readi().
> I understand that this is not an error but a notification that the sound
> card is not ready and should be asked again for data later on.
> 
> Probably the easiest way to get rid of the EGAINs would be to use
> blocking IO, which I would prefer, but I have timing restrictions and
> snd_pcm_readi() has no sort of timeout (which I could see at least).

Just use poll() - it's standard unix interface to wait for an event.

						Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list