[pulseaudio-discuss] avoid increase watermark for low latency capture

pl bossart bossart.nospam at gmail.com
Tue Jul 26 10:50:38 PDT 2011

>>> In fact it's a solution for such firmware hasing  low hw_ptr updating rate.
>>> Pulseaudio use hw_unused field to track the unused buffer, the real overrun
>>> means the "avail" space is geting close to hwbuf_size.

I think this patch has adverse effects for regular hardware.

In the case where the hardware only updates the hw_ptr at every period
and the specified latency is lower than a period, indeed the driver
will either see zero or more bytes than requested. This is interpreted
wrongly as an overflow. The additional test only reports an overflow
if the number of bytes is smaller than the ring buffer and thus avoids
any watermark increase. Let me point out this is a workaround, the
system still does not meet the latency specified as it can only
capture data with a granularity equal to a period.

In addition for regular hardware, the fact that more data is available
means the system does not meet the latency requirements. By adding
this test, the watermark will never be increased to the point where
the latency matches ALSA actual buffering.
There is no real solution other than fixing the firmware if indeed
low-latency is a requirement.
Hope this helps,

More information about the pulseaudio-discuss mailing list