All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: alsa-devel@alsa-project.org
Cc: alsa-devel@vger.kernel.org
Subject: Re: 10 Sec sleep in wait_for_avail_min function
Date: Mon, 13 Dec 2010 10:07:01 +0100	[thread overview]
Message-ID: <4D05E235.1040100@ladisch.de> (raw)
In-Reply-To: <AANLkTim1729oJUmPvOkMGjBBKjb-BnnsWADPx1r3MmZ3@mail.gmail.com>

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
tool?


Regards,
Clemens

           reply	other threads:[~2010-12-13  9:07 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <AANLkTim1729oJUmPvOkMGjBBKjb-BnnsWADPx1r3MmZ3@mail.gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D05E235.1040100@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=alsa-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.