[pulseaudio-discuss] How to control latency with CLI?
Tanu Kaskinen
tanuk at iki.fi
Tue Oct 31 13:37:39 UTC 2017
On Mon, 2017-10-30 at 19:48 +1030, Steven Wawryk wrote:
> > > The limit is the source's max rewind amount, and I see a bug related to
> > > that in module-remap-source (I wouldn't be surprised if it's in other
> > > filter sources too). The remap source max rewind is supposed to mirror
> > > the master source max rewind, but when the master source max rewind
> > > changes, the remap source max rewind isn't updated. The remap source
> > > should set the update_max_rewind source output callback, and use the
> > > callback to update its own max rewind to match the master source.
> > >
> > > If the max rewind isn't updated, as is now the case, it will stay at
> > > whatever value the master source had when the remap source got loaded.
> > > At that time there are likely no streams that are forcing lower
> > > latency, leading to a too high max rewind value when a low latency
> > > stream appears.
> >
> > This seems to be confirmed by the fact that the only max_rewind
> > changes (other than after creation) happen in the module-rtp-send module.
> >
> > Given the platform configuration difficulties I have, can you think of
> > a CLI-based work-around for this?
>
>
> Further confirmation: I removed the module-remap-source load from the
> CLI script, then loaded it manually *after* everything else had started
> up, and the latency has dropped from 4-5minutes to about 1second. I
> guess this hints at a CLI work-around, but I still need to get the
> latency down if I can.
>
> Thanks for the help Tanu.
I submitted a patch for fixing module-remap-source. (You don't need the
alsa sink fix, since you're using the null sink.)
One source of unnecessary latency is that the null sink supports
rewinding, and the max_rewind of the null sink gets added to the remap
source latency. Rewinding is useful with large latencies, but in your
case you're using the null sink with low latency, so for you it would
be best if the null sink didn't do any rewinding. You can modify the
null sink code so that the pa_sink_set_max_rewind(_within_thread) calls
use 0 as the value. I suppose it would be nice to have this
controllable with a module argument.
--
Tanu
https://www.patreon.com/tanuk
More information about the pulseaudio-discuss
mailing list