don't do a pending save if slave is syncing.
authorRobin Gareus <robin@gareus.org>
Tue, 16 Oct 2012 20:53:08 +0000 (20:53 +0000)
committerRobin Gareus <robin@gareus.org>
Tue, 16 Oct 2012 20:53:08 +0000 (20:53 +0000)
13:00 < rgareus> When a slave does initial sync, it sets speed=0, pos=XXX (required by session_process.cc state-machine to init)
13:01 < rgareus> This triggers a locate(roll=false) which in turn triggers a realtime_stop() which in turn triggers a non_realtime_stop().
[..]
13:06 < rgareus> las: the problem I have with non_realtime_stop() is that it does save a pending state IFF  get_record_enabled() is true.
13:06 < rgareus> The save can take ages (seconds), which will void the initial sync of the slave.
13:07 < rgareus> The slave enters a live-lock: sync, save, re-sync, save...
13:07 < las> rgareus: understood
13:07 < rgareus> las: I propose to workaround this: only save pending state if there is no slave or the slave is not locked.
13:07 < las> rgareus: another reason why recording + slave == bad idea :(
13:07 < las> rgareus: but yes, that sounds fine to me
13:07 < rgareus> AFICT this is not harmful. It only affects pre-record settings.
13:07 < rgareus> 'did_record' is used to save a full state after each recording.

git-svn-id: svn://localhost/ardour2/branches/3.0@13288 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/session_transport.cc

index 6141716301c23615e5fb8db2331b50dbcf8c0386..ae5a8157c7f2330779db4093e85c5dd60e61fe2d 100644 (file)
@@ -618,9 +618,19 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
        }
 
        if ((ptw & PostTransportLocate) && get_record_enabled()) {
-               /* capture start has been changed, so save pending state */
-               save_state ("", true);
-               saved = true;
+               /* This is scheduled by realtime_stop(), which is also done
+                * when a slave requests /locate/ for an initial sync.
+                * We can't hold up the slave for long with a save() here,
+                * without breaking its initial sync cycle.
+                *
+                * save state only if there's no slave or if it's not yet locked.
+                */
+               if (!_slave || !_slave->locked()) {
+                       DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: pending save\n"));
+                       /* capture start has been changed, so save pending state */
+                       save_state ("", true);
+                       saved = true;
+               }
        }
 
        /* always try to get rid of this */