From b196cef2c4443ca2a6e7d26b03b3691d0ad706c5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 25 Apr 2020 17:52:54 +0200 Subject: Prevent delay-line reconfiguration while processing Various backends have different strategies for updating latencies, and different thread semantics for latency update callbacks. With jack2 it is possible that processing happens concurrently while port latencies are being changed. Ardour internal backends emit the latency callback from the main process thread, serializing latency changes with processing. Various user actions can also trigger latency changes. e.g. with a stopped engine it is possible to re-order plugins. --- libs/ardour/route.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'libs/ardour/route.cc') diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index c50b4aab25..e9e2e4604b 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2202,6 +2202,8 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err _pending_processor_order.clear (); setup_invisible_processors (); + update_signal_latency (true); + processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */ set_processor_positions (); } else { @@ -2226,6 +2228,12 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err } lm.release(); + + /* update processor input/output latency (total signal_latency does not change). + * delaylines may changes, so the Engine Lock is required. + */ + update_signal_latency (true); + lx.release(); processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */ @@ -2240,11 +2248,6 @@ Route::reorder_processors (const ProcessorList& new_order, ProcessorStreams* err g_atomic_int_set (&_pending_process_reorder, 1); } - /* update processor input/output latency - * (total signal_latency does not change) - */ - update_signal_latency (true); - return 0; } -- cgit v1.2.3