add in timing for disk buffer reload after locate, to replace hard-coded 0.05 seconds per track

Leave debug output in place for now to get some numbers from any testers
This commit is contained in:
Paul Davis 2020-03-23 17:05:35 -06:00
parent c765079b2f
commit b3a1cbbfa2
5 changed files with 22 additions and 3 deletions

View File

@ -1740,6 +1740,7 @@ private:
};
volatile guint _punch_or_loop; // enum PunchLoopLock
gint current_usecs_per_track;
bool punch_active () const;
void unset_punch ();

View File

@ -508,4 +508,3 @@ Butler::drop_references ()
} // namespace ARDOUR

View File

@ -272,6 +272,7 @@ Session::Session (AudioEngine &eng,
, ltc_timecode_negative_offset (false)
, midi_control_ui (0)
, _punch_or_loop (NoConstraint)
, current_usecs_per_track (1000)
, _tempo_map (0)
, _all_route_group (new RouteGroup (*this, "all"))
, routes (new RouteList)

View File

@ -1325,7 +1325,15 @@ Session::plan_master_strategy (pframes_t nframes, double master_speed, samplepos
samplepos_t locate_target = master_transport_sample;
locate_target += wlp + lrintf (ntracks() * sample_rate() * 0.05);
/* locate to a position "worst_latency_preroll" head of
* the master, but also add in a generous estimate to
* cover the time it will take to locate to that
* position, based on our worst-case estimate for this
* session (so far).
*/
cerr << "chase/locate using " << current_usecs_per_track << " usecs/track\n";
locate_target += wlp + lrintf (ntracks() * sample_rate() * (1.5 * (current_usecs_per_track / 1000000.0)));
DEBUG_TRACE (DEBUG::Slave, string_compose ("After locate-to-catch-master, still too far off (%1). Locate again to %2\n", delta, locate_target));

View File

@ -1268,6 +1268,9 @@ Session::non_realtime_locate ()
/* no more looping .. should have been noticed elsewhere */
}
microseconds_t start;
uint32_t nt = 0;
int hundreths_of_second_per_track = 0;
samplepos_t tf;
@ -1277,14 +1280,21 @@ Session::non_realtime_locate ()
restart:
gint sc = g_atomic_int_get (&_seek_counter);
tf = _transport_sample;
start = get_microseconds ();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i, ++nt) {
(*i)->non_realtime_locate (tf);
if (sc != g_atomic_int_get (&_seek_counter)) {
std::cerr << "\n\nLOCATE INTERRUPTED BY LOCATE!!!\n\n";
goto restart;
}
}
microseconds_t end = get_microseconds ();
int usecs_per_track = lrintf ((end - start) / (double) nt);
if (usecs_per_track > g_atomic_int_get (&current_usecs_per_track)) {
g_atomic_int_set (&current_usecs_per_track, usecs_per_track);
}
}
{