As some of you have seen on IRC, I spent the some of the last week fighting rewinds.

An never-ending stream of rewinds seems to be one of the most common reasons PulseAudio crashes or produces crackling/stuttering output, so there is a strong incentive to fix it.

However, the problem is quite complex and there does not seem to be one perfect fix, it's more of an optimisation problem. GStreamer in particular sends out many small data packages, and PulseAudio does not handle that very well.

When the sink-input buffer is empty, going from there to a full buffer is an uphill battle in terms of CPU power, as PulseAudio will try to rewind (at RT priority!) and mix the new data into it; all with the very best intent, but the end result of taking CPU power away from the client.

GStreamer has at least two problems:
* It starts/uncorks the stream when the buffer is empty (this might have been fixed by Wim a day or two ago)
 * It sends out very small packages (c:a 1 - 4K).

Here are three patches trying to help out on the PA side.

* The first one is a relatively simple optimisation than can cut the rewinds in half by allowing both a seek and a post to be merged into one rewind. * The second one builds on the first, and adds the possibility for several data packages to share a rewind by checking if there are more data packets in queue before doing a rewind. * The third makes sure that after an underrun, there is a little headroom before asking for a rewind.

Hopefully this will improve the situation for at least a few users. The idea is to let you do initial comment and review, then make a package and ask some Ubuntu users to test it. After that I'll report back and we can consider inclusion into stable-queue.

--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

Reply via email to