[alsa-devel] hw_ptr accuracy with intel8x0 -> PulseAudio issue

Raymond Yau superquad.vortex2 at gmail.com
Sun Dec 13 05:01:31 CET 2009

2009/12/9 Colin Guthrie <gmane at colin.guthr.ie>

> 'Twas brillig, and Takashi Iwai at 09/12/09 13:46 did gyre and gimble:
> >> PA only adjust the watermark/sleeping time in one direction only
> >
> > Yes.
> Actually there is code in PA to move the watermark in both ways, but
> obviously reverting it backtowards the "underrun zone" is a bit
> dangerous, so can't be just a simple "reduce it" back.
> http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=050a3a99e1d151b4f55c89f82073ef33f3399646
> I can't remember the current status (i.e. if the code is disabled or
> not) but AFAICT it's enabled.
> Col

What is hwbuf_unused in the watermark calculation ?

Refer to *Image 1:* *Schematic overview of the playback buffer in the
traditional playback model, in the best way the author can visualize this
with his limited drawing abilities.*


When the alsa application using 4 periods , the alsa driver is about 75%
full at all time. The data remain in the buffer is many time of the minimum
period bytes ( 32 bytes in the case of intel8x0 )

1) It seem that 32byes is the PCI brust size ? ( hda driver seem has 128
bytes and usb driver ....)

PulseAudio <= 0.9.10 uses a fragment size of 25ms by default, with four

Glitch Free mode

If no client specified any requirements we fill up the whole buffer all the
time, i.e. have an actual latency of 2s. However, if some applications
specified requirements, we take the lowest one and only use as much of the
configured hardware buffer as this value allows us. In practice, this means
we only partially fill the buffer each time we wake up. Then, we configure a
system timer to wake us up 10ms before the buffer would run empty and fill
it up again then. If the overall latency is configured to less than 10ms we
wakeup after half the latency requested.

Correct me If I am wrong

1) The function of alsa-plugin is to emulate an ALSA device

2) The hardware pointer of this pulse device is the application pointer of
the pulseaduio server

3) If PA server did not write any thing up when the timer wake up, this mean
that the hardware pointer of  the pulse device also stop moving.

More information about the Alsa-devel mailing list