loopback: Initialize latency at startup and during source/sink changes

System Internals / PulseAudio - Georg Chini [chini.tk] - 28 February 2017 11:04 UTC

The current code does not make any attempt to initialize the end-to-end latency to a value near the desired latency. This leads to underruns at startup because the memblockq is initially empty and to very long adjustment times for long latencies because the end-to-end latency at startup is significantly shorter than the desired value. This patch initializes the memblockq at startup and during source or sink changes so that the end-to-end latency will be near the configured value. It also ensures that there are no underruns if the source is slow to start and that the latency does not grow too much when the sink is slow to start by adjusting the length of the memblockq until the source has called push for the first time and the sink has called pop for the second time. Waiting for the second pop is necessary because the sink has not been started when the first pop is called. For clarity, variables have been separated into input, output and main thread
variables.

f8e7354 loopback: Initialize latency at startup and during source/sink changes
src/modules/module-loopback.c | 324 +++++++++++++++++++++++++++++++++++++-----
1 file changed, 290 insertions(+), 34 deletions(-)

Upstream: cgit.freedesktop.org


  • Share