Fix latency report for unconnected tracks

When a track's output is not connected, its alignment
can /float/. Previously it assumed the worst (compensate
for worst-case latency).

The track itself has no playback latency, so any send would
delay the 'thru' path to match the send's playback latency.
This resulted in the track reporting a non-zero latency which
is not really present, nor relevant.
This commit is contained in:
Robin Gareus 2021-08-16 22:19:36 +02:00
parent 535a6728a0
commit a556e96ed0
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 7 additions and 1 deletions

View File

@ -4290,7 +4290,13 @@ Route::update_signal_latency (bool apply_to_delayline, bool* delayline_update_ne
samplecnt_t capt_lat_in = _input->connected_latency (false);
samplecnt_t play_lat_out = _output->connected_latency (true);
samplecnt_t in_latency = _input->latency ();
_output_latency = _output->latency ();
/* When the track's output is not connected, align it to master-out.
* Effectively we want to configure all latent-sends to not introduce any latency.
* Since the output is not used, Send::_thru_delay is not relevant, and
* Send->effective_latency () should return zero.
*/
_output_latency = _output->connected () ? _output->latency () : (_session.master_out() ? _session.master_out()->output ()->latency () : 0);
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);