From 19067f8c8792083e71ea9fc69e2c3bfee65c0c95 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 1 Feb 2022 23:49:38 +0100 Subject: [PATCH] Another refinement to address bounce + callback concurrency see also 2eaa0183ef0b051dac40ab61e3a23716fd2f56a3 --- libs/ardour/audioengine.cc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 082e56137f..9be6248069 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -309,11 +309,21 @@ AudioEngine::process_callback (pframes_t nframes) } if (lp || lc) { tm.release (); - if (lc) { - _session->update_latency (false); - } - if (lp) { - _session->update_latency (true); + /* re-check after releasing lock */ + if (_session->processing_blocked ()) { + if (lc) { + g_atomic_int_set (&_pending_capture_latency_callback, 1); + } + if (lp) { + g_atomic_int_set (&_pending_playback_latency_callback, 1); + } + } else { + if (lc) { + _session->update_latency (false); + } + if (lp) { + _session->update_latency (true); + } } tm.acquire (); }