From: Takashi Iwai Subject: Re: Misusing snd_pcm_avail_update() Date: Wed, 21 Jan 2009 01:39:31 +0100 Message-ID: References: <20090120025727.GA30499@tango.0pointer.de> <49758B71.8090605@ladisch.de> <20090120142614.GA27494@tango.0pointer.de> <49761C79.8060605@ladisch.de> <20090120202933.GA17626@tango.0pointer.de> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 6DCDF1037E3 for ; Wed, 21 Jan 2009 01:39:32 +0100 (CET) In-Reply-To: <20090120202933.GA17626@tango.0pointer.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Lennart Poettering Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Tue, 20 Jan 2009 21:29:34 +0100, Lennart Poettering wrote: > > On Tue, 20.01.09 19:48, Clemens Ladisch (clemens@ladisch.de) wrote: > > > > I currently deal with this by always halving the first wakeup time -- > > > which works most of the time but is a hack. > > > > In theory, you could deduce this behaviour from > > snd_pcm_hw_params_is_double(), but the USB driver forgets to set this > > flag. > > But still, with this flag I would only now that the startup sequence > is "fast". But not how "fast". > > I appears to me that it would make a lot more sense if the driver > would simply tell me how long I may sleep instead of adding multiple > new functions 1) that tell me if double-buffering is used and what the > size of the second buffer is, 2) that tell me that data is pulled > block-by-block from the buffer and what the block size is, and so on. > > The function should look like this: > > snd_pcm_sframes_t snd_pcm_busy_for(snd_pcm_t *pcm); > > I called the prototype "busy for" since effectively the value I am > looking for is the time the card will be busy with the data it already > has, and doesn't need any new data. Isn't it snd_pcm_delay() that was originally designed for? Did you check my previous patch? Takashi