On Tue, 2016-08-16 at 20:51 +0200, Georg Chini wrote: > On 16.08.2016 19:07, Tanu Kaskinen wrote: > > > > On Sun, 2016-06-05 at 21:05 +0200, Georg Chini wrote: > > > --- > > > Â src/modules/module-loopback.c | 18 ++++++++++++++++-- > > > Â 1 file changed, 16 insertions(+), 2 deletions(-) > > > > > > diff --git a/src/modules/module-loopback.c b/src/modules/module- > > > loopback.c > > > index c54b531..c773a98 100644 > > > --- a/src/modules/module-loopback.c > > > +++ b/src/modules/module-loopback.c > > > @@ -539,7 +539,12 @@ static bool > > > source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) { > > > Â Â Â Â Â Â if (!u->sink_input || !u->sink_input->sink) > > > Â Â Â Â Â Â Â Â Â Â return true; > > > Â Â > > > -Â Â Â Â return dest != u->sink_input->sink->monitor_source; > > > +Â Â Â Â /* We may still be adjusting, so reset rate to default before > > > moving the source */ > > > +Â Â Â Â if (dest != u->sink_input->sink->monitor_source) { > > > +Â Â Â Â Â Â Â Â pa_sink_input_set_rate(u->sink_input, u->source_output- > > > > > > > > sample_spec.rate); > > > +Â Â Â Â Â Â Â Â return true; > > > +Â Â Â Â } > > > +Â Â Â Â return false; > > This is not the right place to reset the rate. Even if we return true > > here, it doesn't mean that the stream will actually be moved, so we may > > end up resetting the rate needlessly. > > It is not a big problem, if the rate is reset unnecessarily, it will quickly > go back to the equilibrium value. It might however be a problem, > if we are switching source or sink rapidly and are still getting rid of > the initial latency error from the previous switch. Then the rate has > not yet reached the equilibrium and may be far from the nominal > rate. (this is what I mean with "still adjusting"). > So it is important to switch the rate back to nominal __before__ > switching to a new sink or source. Is there some problem with using the moving callback? --Â Tanu