avoid double-locates when locate-while-rolling

We know when we call non_realtime_stop() if we will be subsequently
locating. If so, do not do an additional non_realtime_locate() from
within the stop.
This commit is contained in:
Paul Davis 2022-03-17 17:41:08 -06:00
parent 8ebd097df9
commit a4459ebf9c
2 changed files with 10 additions and 7 deletions

View File

@ -1876,7 +1876,7 @@ private:
void non_realtime_start_scrub ();
void non_realtime_set_speed ();
void non_realtime_locate ();
void non_realtime_stop (bool abort, int entry_request_count, bool& finished);
void non_realtime_stop (bool abort, int entry_request_count, bool& finished, bool will_locate);
void non_realtime_overwrite (int entry_request_count, bool& finished, bool reset_loop_declicks);
void engine_halted ();
void engine_running ();

View File

@ -1167,18 +1167,21 @@ Session::butler_transport_work (bool have_process_lock)
}
}
const int butler = g_atomic_int_get (&_butler_seek_counter);
const int rtlocates = g_atomic_int_get (&_seek_counter);
const bool will_locate = (butler != rtlocates);
if (ptw & PostTransportStop) {
non_realtime_stop (ptw & PostTransportAbort, on_entry, finished);
non_realtime_stop (ptw & PostTransportAbort, on_entry, finished, will_locate);
if (!finished) {
g_atomic_int_dec_and_test (&_butler->should_do_transport_work);
goto restart;
}
}
const int butler = g_atomic_int_get (&_butler_seek_counter);
const int rtlocates = g_atomic_int_get (&_seek_counter);
if (butler != rtlocates) {
if (will_locate) {
DEBUG_TRACE (DEBUG::Transport, string_compose ("nonrealtime locate invoked from BTW (butler has done %1, rtlocs %2)\n", butler, rtlocates));
non_realtime_locate ();
}
@ -1332,7 +1335,7 @@ Session::follow_playhead_priority ()
}
void
Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
Session::non_realtime_stop (bool abort, int on_entry, bool& finished, bool will_locate)
{
struct tm* now;
time_t xnow;
@ -1501,7 +1504,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
/* reset loop_changing so it does not affect next transport action */
loop_changing = false;
if (!_transport_fsm->declicking_for_locate()) {
if (!will_locate && !_transport_fsm->declicking_for_locate()) {
DEBUG_TRACE (DEBUG::Transport, X_("Butler PTW: locate\n"));