pulsecore: Add alternative time smoother implementation

System Internals / PulseAudio - Georg Chini [chini.tk] - 3 November 2021 21:13 UTC

This patch adds an alternative time smoother implementation based on the theory found at https://www.freedesktop.org/software/pulseaudio/misc/rate_estimator.odt.

The functions were written to replace the current smoother functions nearly on a one-to-one basis, though there are a few differences:- The smoother_2_put() function takes a byte count instead of a sound card time as argument. This was changed because in most places a sample count was converted to a time before passing it to the smoother.- The smoother needs to know sample rate and frame size to convert byte counts to time.- A smoother_2_get_delay() function was added to directly retrieve the stream delay from the smoother.- A hack for USB devices was added which works around an issue in the alsa latency reports for USB devices.

The smoother delivers much better precision than the current implementation. For results, see the document referenced above.

The new functions are still unused. The following patches will convert all callers of the smoother functions so that they can use both smoother implementations, depending on a configure option.


156b57295 pulsecore: Add alternative time smoother implementation
po/POTFILES.in | 1 +
src/meson.build | 2 +
src/pulsecore/time-smoother_2.c | 408 ++++++++++++++++++++++++++++++++++++++++
src/pulsecore/time-smoother_2.h | 53 ++++++
4 files changed, 464 insertions(+)

Upstream: cgit.freedesktop.org

  • Share