[alsa-devel] Misusing snd_pcm_avail_update()

Clemens Ladisch clemens at ladisch.de
Thu Jan 29 09:28:12 CET 2009


Lennart Poettering wrote:
> On Fri, 23.01.09 18:56, Clemens Ladisch (clemens at ladisch.de) wrote:
> > Instead of writing a callback in the USB driver to compute the time
> > until the next underrun, I'd rather rip out that fast start code.

(Done.)

> > So, no kernel computation is needed.  :-)
> 
> While I think it would be good not have this kind of double-buffering
> I wonder if this is really future-proof. i.e. can this done with every
> driver that uses 'fast starts'? 

Yes, because the USB driver was the only one that did this.

There are other drivers that use double-buffering (and the USB driver
still does), but there the playback speed does not change, i.e., the
stream is not more underrun-prone when starting.

> > * For many devices (legacy ISA, etc.), we just don't know the correct
> >   value.
> 
> But it should be possible to pick a safe boundary, shouldn't it?

In theory, the _safe_ boundary is one period.  In practice, ISA devices
cannot afford to prefetch much data due to the low bus bandwidth, so
one (frame) should be OK.  (And we _know_ devices that do whole-period
double-buffering because the code is right there in the driver.)


Best regards,
Clemens


More information about the Alsa-devel mailing list