diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index acddc02539..9326bedb35 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -304,7 +304,7 @@ public: void refill_all_track_buffers (); Butler* butler() { return _butler; } - void butler_transport_work (); + void butler_transport_work (bool have_process_lock = false); void refresh_disk_space (); diff --git a/libs/ardour/session_export.cc b/libs/ardour/session_export.cc index 78aec6c759..f167b17f66 100644 --- a/libs/ardour/session_export.cc +++ b/libs/ardour/session_export.cc @@ -300,7 +300,7 @@ Session::process_export_fw (pframes_t nframes) } set_transport_speed (1.0, false, false, false); - butler_transport_work (); + butler_transport_work (true); g_atomic_int_set (&_butler->should_do_transport_work, 0); butler_completed_transport_work (); /* Session::process_with_events () sets _remaining_latency_preroll = 0 diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 45275f6980..803012c3c1 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1099,7 +1099,7 @@ Session::solo_selection (StripableList &list, bool new_state) void -Session::butler_transport_work () +Session::butler_transport_work (bool have_process_lock) { /* Note: this function executes in the butler thread context */ @@ -1154,7 +1154,10 @@ Session::butler_transport_work () if (ptw & PostTransportAdjustPlaybackBuffering) { /* need to prevent concurrency with ARDOUR::Reader::run(), * DiskWriter::adjust_buffering() re-allocates the ringbuffer */ - Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); + Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK); + if (!have_process_lock) { + lx.acquire (); + } for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); if (tr) { @@ -1172,7 +1175,10 @@ Session::butler_transport_work () if (ptw & PostTransportAdjustCaptureBuffering) { /* need to prevent concurrency with ARDOUR::DiskWriter::run(), * DiskWriter::adjust_buffering() re-allocates the ringbuffer */ - Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); + Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK); + if (!have_process_lock) { + lx.acquire (); + } for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); if (tr) {