diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 1102b9a812..b0c8ae6d6d 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -288,13 +288,27 @@ AudioEngine::process_callback (pframes_t nframes) * port registration (usually while ardour holds the process-lock * or with _adding_routes_in_progress or _route_deletion_in_progress set, * potentially while processing in parallel. + * + * Note: this must be done without holding the _process_lock */ if (_session) { + bool lp = false; + bool lc = false; if (g_atomic_int_compare_and_exchange (&_pending_playback_latency_callback, 1, 0)) { - _session->update_latency (true); + lp = true; } if (g_atomic_int_compare_and_exchange (&_pending_capture_latency_callback, 1, 0)) { - _session->update_latency (false); + lc = true; + } + if (lp || lc) { + tm.release (); + if (lp) { + _session->update_latency (true); + } + if (lc) { + _session->update_latency (false); + } + tm.acquire (); } } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 52a194ad7c..f925543558 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -4861,6 +4861,8 @@ Route::update_port_latencies (PortSet& from, PortSet& to, bool playback, samplec p->set_private_latency_range (all_connections, playback); } + DEBUG_TRACE (DEBUG::LatencyRoute, string_compose ("%1: priv. port L(%2) = (%3, %4) + %5\n", _name, playback ? "playback" : "capture", all_connections.min, all_connections.max, our_latency)); + /* set the ports "in the direction of the flow" to the same value as above plus our own signal latency */ all_connections.min += our_latency;