[alsa-devel] 10 Sec sleep in wait_for_avail_min function

Clemens Ladisch clemens at ladisch.de
Mon Dec 13 10:07:01 CET 2010

Nitin Arora wrote:
> I need to stream audio from my audio device to the host through USB.
> While audio is being streamed and songs are being played on the host
> and during that I plug out the audio device, Disconnect event takes
> too long to get reported and displayed on the screen (on GUI).
> I dug this problem a little deeper and found that when my application is
> continuous invoking read on the audio device to capture and audio data
> it follows this path:
> .... .. snd_pcm_lib_read -> snd_pcm_lib_read1 -> snd_pcm_capture_avail
> and in the case when there is no data left (MY DISCONNECT CASE)
> it invokes as follows:
> .... .. snd_pcm_lib_read -> snd_pcm_lib_read1 -> wait_for_avail_min
> and in wait_for_avail_min it sleeps for 10 sec.

This ten-second timeout is intended for devices where the interrupt does
not work for some reason.

In the case of USB disconnection, the driver should stop the stream
immediately.  Does this happen if you try to record with the arecord

To unsubscribe from this list: send the line "unsubscribe alsa-devel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the Alsa-devel mailing list