diff --git a/srtcore/common.cpp b/srtcore/common.cpp index 8af2db5da..b2c5f6c3b 100644 --- a/srtcore/common.cpp +++ b/srtcore/common.cpp @@ -214,7 +214,11 @@ void CTimer::sleepto(uint64_t nexttime) __nop (); #endif #else - const uint64_t wait_us = 10000; // 10 ms + const uint64_t wait_us = (m_ullSchedTime - t) / CTimer::getCPUFrequency(); + // The while loop ensures that (t < m_ullSchedTime). + // Division by frequency üøïðå loos prevision. + if (wait_us == 0) + break; timeval now; gettimeofday(&now, 0);