[pulseaudio-discuss] [PATCH v6 00/25] Optimize latency handling in module-loopback

Georg Chini georg at chini.tk
Thu Jul 14 09:59:44 UTC 2016


On 14.07.2016 00:18, Tanu Kaskinen wrote:
> On Sun, 2016-06-05 at 21:05 +0200, Georg Chini wrote:
>> 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(-)
> I pushed the first 8 patches now, since they're fine and I don't need
> them to be resubmitted. (I complained about a variable name in patch 2,
> but the variable can be renamed in a separate commit.) The 9th patch
> had some issues, so patches from that onwards probably need to be
> resubmitted. You can resubmit at any time you like, or you can wait
> until I've commented on the rest of the patches.
Thanks for review and pushing the first patches. I'll wait until your
review is complete before I re-submit, otherwise I will probably have
to change things too often.



More information about the pulseaudio-discuss mailing list