85 if (frame.isValid() && !checkSessionID(frame.sourceID().sessionID)) {
86 qCDebug(qLcRenderer) <<
"Frame session outdated. Source id:" << frame.sourceID() <<
"current id:" << id();
91 const bool frameOutdated = frame.isValid() && frame.absoluteEnd() < seekPosition();
94 qCDebug(qLcRenderer) <<
"frame outdated! absEnd:" << frame.absoluteEnd().get() <<
"absPts"
95 << frame.absolutePts().get() <<
"seekPos:" << seekPosition().get();
97 emit frameProcessed(std::move(frame));
101 m_sessionCtx.frames.enqueue(std::move(frame));
103 if (m_sessionCtx.frames.size() == 1)
133 using namespace std::chrono_literals;
135 if (m_sessionCtx.frames.empty())
136 return PlaybackEngineObject::nextTimePoint();
138 if (m_sessionCtx.explicitNextFrameTime)
139 return *m_sessionCtx.explicitNextFrameTime;
141 if (m_sessionCtx.frames.front().isValid())
142 return m_sessionCtx.timeController.timeFromPosition(
143 m_sessionCtx.frames.front().absolutePts());
145 if (m_sessionCtx.lastFrameEnd > TrackPosition(0))
146 return m_sessionCtx.timeController.timeFromPosition(m_sessionCtx.lastFrameEnd);
148 return PlaybackEngineObject::nextTimePoint();
163 Frame frame = m_sessionCtx.frames.front();
172 const auto result = renderInternal(frame);
173 const bool frameIsValid = frame.isValid();
176 m_sessionCtx.explicitNextFrameTime.reset();
177 m_sessionCtx.frames.dequeue();
180 m_sessionCtx.lastPosition.storeRelease(
181 std::max(frame.absolutePts(), lastPosition()).get());
184 m_sessionCtx.lastFrameEnd = frame.absoluteEnd();
185 m_sessionCtx.seekPos.storeRelaxed(m_sessionCtx.lastFrameEnd.get());
187 const auto loopIndex = frame.loopOffset().loopIndex;
188 if (m_sessionCtx.loopIndex < loopIndex) {
189 m_sessionCtx.loopIndex = loopIndex;
190 emit loopChanged(id(), frame.loopOffset().loopStartTimeUs, m_sessionCtx.loopIndex);
193 emit frameProcessed(std::move(frame));
195 m_sessionCtx.lastPosition.storeRelease(
196 std::max(m_sessionCtx.lastFrameEnd, lastPosition()).get());
199 m_sessionCtx.explicitNextFrameTime = SteadyClock::now() + result.recheckInterval;
202 setAtEnd(result.done && !frameIsValid);
215 const auto now = SteadyClock::now();
216 const auto pos = m_sessionCtx.timeController.positionFromTime(now);
217 m_sessionCtx.timeController.sync(now + offset, pos);
218 emit synchronized(id(), now + offset, pos);