Fix DR refill when exporting multiple timespans #8742

In between timespans Ardour disables freewheeling and
only later resumes freewheel. It can happen that
Session::process can summon the butler while start_audio_export()
calls Track::seek.

Just waiting for an earlier Butler::wait_until_finished() does
not prevent the butler from running again later.

This can lead to concurrent calls of DR::refill_audio from both
the butler and start_audio_export(), leading to garbled buffers.
This commit is contained in:
Robin Gareus
2021-06-14 02:18:54 +02:00
parent ec131fcb70
commit 21f4598395

View File

@@ -161,11 +161,12 @@ Session::start_audio_export (samplepos_t position, bool realtime, bool region_ex
it here.
*/
_butler->wait_until_finished ();
{
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
_butler->wait_until_finished ();
/* get everyone to the right position */
{
boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {