diff options
author | Robin Gareus <robin@gareus.org> | 2020-03-06 21:34:55 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-03-06 21:34:55 +0100 |
commit | dd46dfe8d2d5aa57a7bbf14da5b992404fed8b27 (patch) | |
tree | 2464cc5c2d0ac3c7cd056dc6d7e4350b351c83d9 /libs | |
parent | 77d12b490ed05e1257eb638ee47f55268b4dcfeb (diff) |
Fix potential deadlock when exporting w/normalizing
start_post_processing() may be called from the freewheeling
callback, when starting to normalize.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/export_graph_builder.h | 3 | ||||
-rw-r--r-- | libs/ardour/export_graph_builder.cc | 13 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index b70db3c96b..07a878ae8b 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -278,7 +278,8 @@ class LIBARDOUR_API ExportGraphBuilder bool _realtime; samplecnt_t _master_align; - Glib::ThreadPool thread_pool; + Glib::ThreadPool thread_pool; + Glib::Threads::Mutex engine_request_lock; }; } // namespace ARDOUR diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index eb74d44fd4..ccddc83881 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -678,12 +678,19 @@ ExportGraphBuilder::Intermediate::prepare_post_processing() void ExportGraphBuilder::Intermediate::start_post_processing() { - /* called in disk-thread (when exporting in realtime) */ tmp_file->seek (0, SEEK_SET); - /* RT Stem export has multiple TmpFileRt threads, + + /* called in disk-thread when exporting in realtime, + * to enable freewheeling for post-proc. + * + * It may also be called to normalize from the + * freewheeling rt-callback, in which case this + * will be a no-op. + * + * RT Stem export has multiple TmpFileRt threads, * prevent concurrent calls to enable freewheel () */ - Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ()); + Glib::Threads::Mutex::Lock lm (parent.engine_request_lock); if (!AudioEngine::instance()->freewheeling ()) { AudioEngine::instance()->freewheel (true); while (!AudioEngine::instance()->freewheeling ()) { |