[pulseaudio-discuss] Dynamic growth of buffer size

Kurt Taylor kurt.taylor at linaro.org
Thu Jan 20 13:16:24 PST 2011

I have been experimenting with different buffer sizes to see if I can enable
ARM to drop into a lower power state. I have been speaking to some of you
via IRC, but I wanted to put some thoughts down on what I am trying to do
and get feedback. I have reviewed the maillist archives and have read up on
the rewind proposal (it was good to meet you in Dallas, David) and the
period irq disable work being done as well as other ARM specific

Here is what I am thinking:
>From what I can tell at this point, the hw buffer is set initially in
alsa-utils.c. with pa_alsa_set_hw_params, it looks like the default for my
PC is 2 sec (2000ms).  I have experimented with 2x growth of the buffer with
some interesting results in CPU wakesper second. This was very far from
scientific, but using paplay and powertop on a lightly loaded system -> 2s =
~103wps, 4s = ~103wps, 8s = ~88wpc, 16s = ~100wpc. It looks like the sweet
spot on my PC was 8 seconds. For comparison, using aplay produced ~72wps.
With the extra functionality that PulseAudio provides, that looks pretty

Along with increasing the buffer size, the tsched wakeup watermark will need
to be increased, although my initial prototype code did not do that. I
waited until the watermark increased to the point where there were no more
underruns before using powertop. On my PC, it seems like the process for
decreasing the watermark is very aggressive, maybe to the point of causing
more underruns than needed.

I plan on doing more testing, but on an ARM based platform, obviously, I am
looking for a buffer growth tuning for ARM that will reduce CPU wakes. For
dynamic growth, I am thinking that with the check_left_to_play (alsa-sink.c)
when woken by a timeout, it would be a good time to try to increase buffer
size and hopefully allowing ARM to go to a lower power state on long plays.
The buffer would be set back to normal default when rewinding, etc.

This is not fully baked yet - I have more work to do, but I wanted to get
any comments/suggestions early.

Kurt Taylor (irc krtaylor)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20110120/3e5790eb/attachment.htm>

More information about the pulseaudio-discuss mailing list