60 m_timer = std::make_unique<QChronoTimer>();
61 m_timer->setTimerType(Qt::PreciseTimer);
62 m_timer->setSingleShot(
true);
63 connect(m_timer.get(), &QChronoTimer::timeout,
this, &PlaybackEngineObject::onTimeout);
90 using std::chrono::milliseconds;
91 using namespace std::chrono_literals;
93 if (isValid() && canDoNextStep())
94 m_nextTimePoint = nextTimePoint();
96 m_nextTimePoint.reset();
98 if (m_stepType == StepType::Immediate)
102 auto now = [&nowCached,
this]() {
103 Q_ASSERT(m_nextTimePoint);
106 Q_ASSERT(m_nextTimePoint);
107 if (*m_nextTimePoint == TimePoint::min())
109 nowCached = TimePoint::min();
111 nowCached = SteadyClock::now();
117 if (m_stepType == StepType::None && m_nextTimePoint) {
118 if (*m_nextTimePoint <= now()) {
119 m_nextTimePoint.reset();
120 doNextStep(StepType::Immediate);
125 if (m_nextTimePoint) {
126 *m_nextTimePoint = std::max(*m_nextTimePoint, now());
127 if (!m_timePoint || *m_nextTimePoint != std::max(*m_timePoint, now())) {
128 timer().setInterval(*m_nextTimePoint - now());
131 }
else if (m_timePoint) {
135 m_timePoint = std::exchange(m_nextTimePoint, std::nullopt);