[pulseaudio-discuss] Dynamic growth of buffer size

Kurt Taylor kurt.taylor at linaro.org
Tue Jan 25 06:19:18 PST 2011

On 24 January 2011 09:21, Kurt Taylor <kurt.taylor at linaro.org> wrote:

> On 20 January 2011 16:45, pl bossart <bossart.nospam at gmail.com> wrote:
>> > 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.
>> You can't really change the size of the buffer, it's defined when you
>> define the hw_params. You can only change the timer value. It think
>> the 'buffer growth' you want is already handled by the concept of
>> latency.
>> We've also experimented with larger buffers. It's not clear to me that
>> you really benefit from 8+ sec buffers. You have other wake-ups in the
>> system that will reduce the benefits of long sleeps. Also as you said
>> the timer watermark needs to take the tlength into account, a fixed
>> initial value isn't very good.
>> And last there is still a wake every 1.5s due to the auto-timing
>> update. It would need to be changed to depend on the latency value.
>> It's been on my TODO list but I still don't understand how the
>> smoother parameters need to be changed.
>> -Pierre
> Thanks for your reply Pierre.
> I am still learning and so I spent some time this weekend experimenting. I
> tried again to show larger buffer size would help, but there was really very
> little difference, just as you suggested. I then tried to change the buffer
> size during a playback, when we woke on_timeout in alsa_sink.c and
> snd_pcm_hw_params failed. In fact, due to the failure, the module was
> actually unloaded.
> I will do more experimentation on watermark reduction and auto-timing
> update with relationship to latency and learn that code better. I was
> wondering if you could elaborate on what you had on your TODO list for this
> area with regards to smoother parameters.
> I am following the dynamic sample rate discussion as that also may help CPU
> on ARM.  Any other comments and suggestions of areas to look at would also
> be appreciated.
> Kurt Taylor (irc krtaylor)
Any other thoughts on buffer size growth? Is there a way to increase it
during playback that I may have missed?

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

More information about the pulseaudio-discuss mailing list