[idd] scheduler: publish frames after guest cadence breaks

Discard the learned guest arrival period when a frame follows a gap
much larger than expected. Force that frame through and relearn the
arrival rate so sparse updates are not held for a frame that never
arrives.
This commit is contained in:
Geoffrey McRae
2026-08-05 09:40:28 +10:00
parent 55f373b4ff
commit d0fa4a8ddd

View File

@@ -28,6 +28,7 @@ static const uint32_t MIN_LEASE_MS = 100;
static const uint32_t MAX_LEASE_MS = 5000; static const uint32_t MAX_LEASE_MS = 5000;
static const uint64_t MIN_SAFETY_NS = 250000ULL; static const uint64_t MIN_SAFETY_NS = 250000ULL;
static const uint64_t LOG_INTERVAL_NS = 5000000000ULL; static const uint64_t LOG_INTERVAL_NS = 5000000000ULL;
static const uint64_t CADENCE_BREAK = 4;
uint64_t CFrameScheduler::Nanotime() uint64_t CFrameScheduler::Nanotime()
{ {
@@ -308,7 +309,14 @@ void CFrameScheduler::ObserveFrame(uint64_t now)
if (m_lastArrival && now > m_lastArrival) if (m_lastArrival && now > m_lastArrival)
{ {
const uint64_t interval = now - m_lastArrival; const uint64_t interval = now - m_lastArrival;
if (interval >= MIN_PERIOD_NS && interval <= MAX_PERIOD_NS) if (m_guestPeriod && interval > m_guestPeriod * CADENCE_BREAK)
{
m_guestPeriod = 0;
m_guestJitter = 0;
m_arrivalSamples = 0;
m_forceNext = true;
}
else if (interval >= MIN_PERIOD_NS && interval <= MAX_PERIOD_NS)
{ {
if (!m_guestPeriod) if (!m_guestPeriod)
m_guestPeriod = interval; m_guestPeriod = interval;