[PATCH 02/21 v2] loopback: Initialize latency at startup and during source/sink changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2017-02-25 at 19:21 +0200, Tanu Kaskinen wrote:
> On Sat, 2017-02-25 at 14:01 +0100, Georg Chini wrote:
> > On 25.02.2017 13:51, Tanu Kaskinen wrote:
> > > The second adjustment does the right thing regardless of whether the
> > > first adjustment was done or not, so why not skip the first adjustment
> > > altogether?
> > 
> > Because it might be the case that we are only switching the source OR the
> > sink and if we are changing both or starting up, we don't know which will
> > come first.
> 
> So you're saying that skipping the first adjustment as I suggested
> can't be done? I think this should do the trick:
> 
> if (pop_adjust) {
>     /* Final adjustment. */
>     offset = sink_latency + source_latency;
>     memblockq_adjust(offset, true);
>     pop_adjust = false;
> } else if (!pop_called) {
>     /* Waiting for the sink to start. */
>     offset = 0;
>     memblockq_adjust(offset, false);
> }
> push_called = true;

That doesn't handle correctly the case where just the source changes.
The first if condition needs to be changed to

if (pop_adjust || (pop_called && !push_called))

-- 
Tanu

https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux