[pulseaudio-discuss] [PATCH 00/21 v2] Optimize latency handling in module-loopback
Georg Chini
georg at chini.tk
Sun Feb 19 16:15:08 UTC 2017
This is version 2 of the new loopback patch series. It includes many fixes
based on Tanu's review as well as two new features. The main changes
compared to the original loopback module are:
- Reduce latency jitter by a factor 100 from around 30 ms to 300 usec
- Implement modified P-controller and optimize adaptive re-sampling
- Underrun protection
- Latency initialisation to avoid underruns
- Adjust to specified latency if possible, else use minimum possible latency
- Allow smooth switching between different sources and sinks
- Wait for source and sink to start up (new in v7)
- Gracefully handle changes of port latency offsets (new in v7)
- some new parameters
Version 1 had a few bugs that have been discovered during extensive testing
and have been fixed in this version.
Results achieved with the new code and theoretical background can be
found at
https://www.freedesktop.org/software/pulseaudio/misc/rate_estimator.odt
Georg Chini (21):
loopback: correct comments about the thread calling a function
loopback: Initialize latency at startup and during source/sink changes
loopback: Do not skip audio at startup
loopback: Calculate and track minimum possible latency
loopback: Add hooks to track port latency offsets
loopback: Reset sink input rate when source or sink changes
loopback: Implement underrun protection
sample.c: Allow module-loopback to exceed PA_RATE_MAX
source/sink: Allow pa_{source,sink}_get_latency_within_thread() to
return negative values
source/sink: Don't let pa_{sink, source}_getLatency_within_thread()
return -1 if process_msg() fails
loopback: Use new feature of
pa_{source,sink}_get_latency_within_thread()
loopback: Track and use average adjust time
loopback: Limit controller step size to 2.01‰
loopback: Optimize adaptive re-sampling
loopback: Add latency prediction and Kalman filter
loopback: Track prediction error; debug and cosmetic changes
loopback: Add adjust_threshold_usec parameter
loopback: Only use controller weight after target latency has been
crossed twice
loopback: Add low_device_latency parameter
loopback: Add adjust_time_msec parameter to allow adjust times below
1s
loopback: Add log_interval and log_interval_msec parameter
src/modules/alsa/alsa-sink.c | 13 +-
src/modules/alsa/alsa-source.c | 8 +-
src/modules/bluetooth/module-bluez4-device.c | 16 +-
src/modules/bluetooth/module-bluez5-device.c | 10 +-
src/modules/echo-cancel/module-echo-cancel.c | 16 +-
src/modules/jack/module-jack-sink.c | 12 +-
src/modules/jack/module-jack-source.c | 2 +-
src/modules/macosx/module-coreaudio-device.c | 4 +-
src/modules/module-combine-sink.c | 5 +-
src/modules/module-equalizer-sink.c | 6 +-
src/modules/module-esound-sink.c | 2 +-
src/modules/module-ladspa-sink.c | 6 +-
src/modules/module-loopback.c | 1120 +++++++++++++++++++++++---
src/modules/module-null-sink.c | 2 +-
src/modules/module-null-source.c | 2 +-
src/modules/module-pipe-sink.c | 2 +-
src/modules/module-pipe-source.c | 2 +-
src/modules/module-remap-sink.c | 6 +-
src/modules/module-remap-source.c | 6 +-
src/modules/module-sine-source.c | 2 +-
src/modules/module-solaris.c | 2 +-
src/modules/module-tunnel-sink-new.c | 10 +-
src/modules/module-tunnel-source-new.c | 12 +-
src/modules/module-tunnel.c | 4 +-
src/modules/module-virtual-sink.c | 8 +-
src/modules/module-virtual-source.c | 6 +-
src/modules/module-virtual-surround-sink.c | 6 +-
src/modules/module-waveout.c | 2 +-
src/modules/oss/module-oss.c | 2 +-
src/modules/raop/raop-sink.c | 11 +-
src/modules/rtp/module-rtp-recv.c | 2 +-
src/pulse/sample.c | 5 +-
src/pulsecore/core.h | 2 +
src/pulsecore/protocol-native.c | 6 +-
src/pulsecore/sink-input.c | 2 +-
src/pulsecore/sink.c | 31 +-
src/pulsecore/sink.h | 2 +-
src/pulsecore/source-output.c | 4 +-
src/pulsecore/source.c | 27 +-
src/pulsecore/source.h | 2 +-
40 files changed, 1137 insertions(+), 251 deletions(-)
--
2.10.1
More information about the pulseaudio-discuss
mailing list