- DEBUG_TRACE (DEBUG::MTC, "*****************\n\n\n MTC SLAVE reset ********************\n\n\n");
- PBD::stacktrace (cerr, 35);
- port->input()->reset_mtc_state ();
-
- last_inbound_frame = 0;
- current.guard1++;
- current.position = 0;
- current.timestamp = 0;
- current.speed = 0;
- current.guard2++;
-
- window_begin = 0;
- window_end = 0;
- last_mtc_frame = 0;
- last_mtc_timestamp = 0;
-
- average_speed = 0;
- have_first_speed_accumulator = false;
- speed_accumulator_cnt = 0;
-
- pic->reset();
-}
-
-void
-MTC_Slave::reset_window (nframes64_t root)
-{
-
- /* if we're waiting for the master to catch us after seeking ahead, keep the window
- of acceptable MTC frames wide open. otherwise, shrink it down to just 2 video frames
- ahead of the window root (taking direction into account).
- */
-
- DEBUG_TRACE (DEBUG::MTC, string_compose ("trying to reset MTC window with state = %1\n", enum_2_string (port->input()->mtc_running())));
-
- switch (port->input()->mtc_running()) {
- case MTC_Forward:
- DEBUG_TRACE (DEBUG::MTC, "set MTC window while running forward\n");
- window_begin = root;
- if (session.slave_state() == Session::Running) {
- window_end = root + (session.frames_per_timecode_frame() * frame_tolerance);
- } else {
- window_end = root + seekahead_distance ();
- }
- break;
-
- case MTC_Backward:
- DEBUG_TRACE (DEBUG::MTC, "set MTC window while running backward\n");
- if (session.slave_state() == Session::Running) {
- nframes_t d = session.frames_per_timecode_frame() * frame_tolerance;
- if (root > d) {
- window_begin = root - d;
- window_end = root;
- } else {
- window_begin = 0;
- }
- } else {
- nframes_t d = seekahead_distance ();
- if (root > d) {
- window_begin = root - d;
- } else {
- window_begin = 0;
- }
- }
- window_end = root;
- break;
-
- default:
- DEBUG_TRACE (DEBUG::MTC, "not touching MTC window - MTC_Stopped\n");
- /* do nothing */
- break;