[alsa-devel] Misusing snd_pcm_avail_update()

Takashi Iwai tiwai at suse.de
Wed Jan 21 01:39:31 CET 2009

At Tue, 20 Jan 2009 21:29:34 +0100,
Lennart Poettering wrote:
> On Tue, 20.01.09 19:48, Clemens Ladisch (clemens at 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?


More information about the Alsa-devel mailing list