From 2eaa0183ef0b051dac40ab61e3a23716fd2f56a3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 1 Feb 2022 21:37:00 +0100 Subject: [PATCH] Fix bounce + latency update concurrency When bouncing Region or Range, Session::write_one_track() blocks processing, but takes no process-lock. It is possible that a latency-callback arrives at the same time while Route::bounce_process is active and calls ::run. This can trigger a delayline.cc Assertion `lm.locked ()' failed in either thread. Now latency-callbacks are postponed until the session can process normally again --- libs/ardour/audioengine.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index d66cad079b..082e56137f 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -298,7 +298,7 @@ AudioEngine::process_callback (pframes_t nframes) * * Note: this must be done without holding the _process_lock */ - if (_session) { + if (_session && !_session->processing_blocked ()) { bool lp = false; bool lc = false; if (g_atomic_int_compare_and_exchange (&_pending_playback_latency_callback, 1, 0)) { @@ -1469,7 +1469,7 @@ AudioEngine::latency_callback (bool for_playback) return; } - if (in_process_thread ()) { + if (in_process_thread () && ! _session->processing_blocked ()) { /* internal backends emit the latency callback in the rt-callback, * async to connect/disconnect or port creation/deletion. * All is fine.