Remove duplicate i/o latency calculation

Port and connection changes always imply a latency_callback from
the engine. Worst I/O latency is updated directly in
Session::update_latency() which is called from
AudioEngine::latency_callback.

Explicit subscriptions to route->output()->changed() is not needed
to update the worst I/O latency.

Only set_block_size() needs to to update the I/O latency when
the buffer-size changes.
This commit is contained in:
Robin Gareus
2020-04-26 21:34:26 +02:00
parent 842e841e0d
commit 31c39ed869
2 changed files with 23 additions and 45 deletions

View File

@@ -1343,14 +1343,11 @@ private:
void update_latency (bool playback);
bool update_route_latency (bool reverse, bool apply_to_delayline);
void initialize_latencies ();
void set_worst_io_latencies ();
void set_worst_output_latency ();
void set_worst_input_latency ();
void send_latency_compensation_change ();
void set_worst_io_latencies_x (IOChange, void *);
void ensure_buffers (ChanCount howmany = ChanCount::ZERO);

View File

@@ -2082,32 +2082,33 @@ void
Session::set_block_size (pframes_t nframes)
{
/* the AudioEngine guarantees
that it will not be called while we are also in
::process(). It is therefore fine to do things that block
here.
*/
* that it will not be called while we are also in
* ::process(). It is therefore fine to do things that block
* here.
*/
current_block_size = nframes;
{
current_block_size = nframes;
ensure_buffers ();
ensure_buffers ();
boost::shared_ptr<RouteList> r = routes.reader ();
boost::shared_ptr<RouteList> r = routes.reader ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_block_size (nframes);
}
boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->set_block_size (nframes);
}
}
set_worst_io_latencies ();
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->set_block_size (nframes);
}
boost::shared_ptr<RouteList> rl = routes.reader ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
if (tr) {
tr->set_block_size (nframes);
}
}
DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_block_size -> update worst i/o latency\n");
/* when this is called from the auto-connect thread, the process-lock is held */
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_output_latency ();
set_worst_input_latency ();
}
@@ -3201,7 +3202,6 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool
r->solo_isolate_control()->Changed.connect_same_thread (*this, boost::bind (&Session::route_solo_isolated_changed, this, wpr));
r->mute_control()->Changed.connect_same_thread (*this, boost::bind (&Session::route_mute_changed, this));
r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2));
r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1));
r->processor_latency_changed.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, this));
@@ -6452,15 +6452,6 @@ Session::initialize_latencies ()
{
update_latency (false);
update_latency (true);
set_worst_io_latencies ();
}
void
Session::set_worst_io_latencies_x (IOChange, void *)
{
DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_worst_io_latencies_x\n");
set_worst_io_latencies ();
}
void
@@ -6587,16 +6578,6 @@ Session::update_latency (bool playback)
LatencyUpdated (playback); /* EMIT SIGNAL */
}
void
Session::set_worst_io_latencies ()
{
DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_worst_io_latencies\n");
/* when this is called from the auto-connect thread, the process-lock is held */
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
set_worst_output_latency ();
set_worst_input_latency ();
}
void
Session::set_worst_output_latency ()
{