From 4601507165eb497d9d63c39743c572eed5624dd8 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 22 Sep 2020 23:35:48 +0200 Subject: [PATCH] Collect and queue processor latency updates This is only relevant when automating a plugin-bypass, due to ActiveChanged the following could happen from the realtime thread: #2 ARDOUR::Session::update_latency_compensation (false, false) #3 PBD::Signal0 > #4 ARDOUR::AutomationControl::actually_set_value #5 ARDOUR::PluginInsert::PluginControl::actually_set_value #6 ARDOUR::PluginInsert::connect_and_run #7 ARDOUR::PluginInsert::automate_and_run In this specific case the update_latency_compensation() is called with process-lock held but the caller lied: called_from_backend=false When a delayline update is needed, this can lead to a deadlock, since the process-lock is acquired again. Simply postponing the update is preferable since this also postpones the change when actively recording. PS. This may need special casing for freewheel export. --- libs/ardour/route.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index ffae44b893..454f96e314 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1139,7 +1139,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr (*i)->activate (); } - (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false)); + (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, &_session)); boost::shared_ptr send; if ((send = boost::dynamic_pointer_cast (*i))) { @@ -1598,7 +1598,7 @@ Route::replace_processor (boost::shared_ptr old, boost::shared_ptrenable (true); } - sub->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false)); + sub->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, &_session)); } reset_instrument_info (); @@ -3138,7 +3138,7 @@ Route::set_processor_state (const XMLNode& node, int version) for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) { (*i)->set_owner (this); - (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false, false)); + (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::queue_latency_recompute, &_session)); boost::shared_ptr pi;