Fix worst-case and I/O latency report

In case there are any unconnected tracks, the track's output is
assumed to align to the master bus (see Route::update_signal_latency).

For this to work correctly the master bus port's public latency
has to be set first.

This fixes e.g. the following issue: add a latent plugin to
the monitor section. Then toggle its bypass or remove it.
Previously the worst-case latency remained unchanged.
This commit is contained in:
Robin Gareus
2023-04-27 01:43:11 +02:00
parent 82e03ac13e
commit dd969dfe8c
2 changed files with 9 additions and 3 deletions

View File

@@ -4378,7 +4378,7 @@ Route::update_signal_latency (bool apply_to_delayline, bool* delayline_update_ne
* Since the output is not used, Send::_thru_delay is not relevant, and
* Send->effective_latency () should return zero.
*/
if (is_master() || output_effectively_connected ()) {
if (is_master() || is_monitor () || output_effectively_connected ()) {
_output_latency = _output->latency ();
} else if (_session.master_out ()) {
/* We cannot use `_session.master_out()->input()->latency()` because that would return capture latency.

View File

@@ -6922,7 +6922,6 @@ Session::update_latency (bool playback)
/* prevent any concurrent latency updates */
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_output_latency ();
update_route_latency (true, /*apply_to_delayline*/ true, NULL);
/* release before emitting signals */
@@ -6932,7 +6931,6 @@ Session::update_latency (bool playback)
/* process lock is not needed to update worst-case latency */
lm.release ();
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_input_latency ();
update_route_latency (false, false, NULL);
}
@@ -6947,6 +6945,14 @@ Session::update_latency (bool playback)
/* now handle non-route ports that we are responsible for */
set_owned_port_public_latency (playback);
if (playback) {
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_output_latency ();
} else {
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_input_latency ();
}
DEBUG_TRACE (DEBUG::LatencyCompensation, "Engine latency callback: DONE\n");
LatencyUpdated (playback); /* EMIT SIGNAL */