From cfd95340b18cc90ea9d0c53ddcd3f21407010de3 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 8 Apr 2020 06:26:47 +0200 Subject: Fix exporting multiple range (MacOS) The actual issue was introduced in 61e7f3176bfd8e: Session::non_realtime_stop() no longer unsets PostTransportStop (other changes from that commit are not relevant). The real issue however is a race-condition. So far this only seems to happen on MacOS, Coreaudio. It seems that non_realtime_stop() is called in the butler-thread after exporting has started, even though the butler has been paused in wait_until_finished(). Perhaps Coreaudio thread switches causes TransportFSM to reinitialize and scheduling the butler? The use of `usleep()` makes this rather a workaround. However it's sufficient for the coreaudio rt thread to run at least once. --- libs/ardour/session_export.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libs/ardour/session_export.cc') diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 4e1dda441e..4f9670d5e2 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -23,6 +23,7 @@ #include "pbd/error.h" #include +#include #include @@ -136,6 +137,8 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex it here. */ + Glib::usleep (engine().usecs_per_cycle ()); + _butler->schedule_transport_work (); _butler->wait_until_finished (); /* get everyone to the right position */ -- cgit v1.2.3