Hi, finally I got around to split the loopback patches. The current version has a lot of improvements over the last version and hopefully incorporates the comments from Tanu's previous review. Main features of the new code are: - Reduce latency jitter by a factor 100 from around 30 ms to 300 usec - Implement modified P-controller and 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 - 3 new parameters The intermediate results are tested to compile but not for functionality. More details can be found in the individual commit messages. The theoretical background of the controller is covered in the document "rate_estimator.odt" which I will send in a separate mail. The document also contains some results achieved with the new code. Georg Chini (25): loopback: Save time stamps during latency snapshots loopback: Improve latency estimation in snapshots loopback: Improve latency estimation loopback: Change memblockq length loopback: Move timer restart and snapshots to time callback loopback: Restart timer after 1/3 second loopback: Adjust rate based on latency difference loopback: Stop tracking max_request and min_memblockq_length loopback: Refactor latency initialization loopback: Do not skip audio at startup loopback: Calculate and track minimum possible latency loopback: Implement underrun protection sample.c: Allow module-loopback to exceed PA_RATE_MAX source.c, sink.c: Implement pa_{source,sink}_get_raw_latency_within_thread() calls alsa-{source,sink}.c: Handle PA_{SOURCE,SINK}_MESSAGE_GET_RAW_LATENCY loopback: Reset sink input rate when source or sink changes loopback: Track and use average adjust time loopback: Limit controller step size to 2.01â?° loopback: Implement adaptive re-sampling loopback: Add latency prediction and Kalman filter loopback: Track prediction error; debug and cosmetic changes loopback: Allow shorter adjust_time loopback: Add low_device_latency parameter loopback: Add adjust_threshold_usec parameter loopback: Add log_interval parameter src/modules/alsa/alsa-sink.c | 25 +- src/modules/alsa/alsa-source.c | 20 +- src/modules/module-loopback.c | 786 +++++++++++++++++++++++++++++++++-------- src/pulse/sample.c | 5 +- src/pulsecore/sink.c | 30 ++ src/pulsecore/sink.h | 2 + src/pulsecore/source.c | 30 ++ src/pulsecore/source.h | 2 + 8 files changed, 732 insertions(+), 168 deletions(-) -- 2.8.1