86 if (frame.isValid() && !checkSessionID(frame.sourceID().sessionID)) {
87 qCDebug(qLcRenderer) <<
"Frame session outdated. Source id:" << frame.sourceID() <<
"current id:" << id();
92 const bool frameOutdated = frame.isValid() && frame.absoluteEnd() < seekPosition();
95 qCDebug(qLcRenderer) <<
"frame outdated! absEnd:" << frame.absoluteEnd().get() <<
"absPts"
96 << frame.absolutePts().get() <<
"seekPos:" << seekPosition().get();
98 emit frameProcessed(std::move(frame));
102 m_sessionCtx.frames.enqueue(std::move(frame));
104 if (m_sessionCtx.frames.size() == 1)
134 using namespace std::chrono_literals;
136 if (m_sessionCtx.frames.empty())
137 return PlaybackEngineObject::nextTimePoint();
139 if (m_sessionCtx.explicitNextFrameTime)
140 return *m_sessionCtx.explicitNextFrameTime;
142 if (m_sessionCtx.frames.front().isValid())
143 return m_sessionCtx.timeController.timeFromPosition(
144 m_sessionCtx.frames.front().absolutePts());
146 if (m_sessionCtx.lastFrameEnd > TrackPosition(0))
147 return m_sessionCtx.timeController.timeFromPosition(m_sessionCtx.lastFrameEnd);
149 return PlaybackEngineObject::nextTimePoint();
164 Frame frame = m_sessionCtx.frames.front();
173 const auto result = renderInternal(frame);
174 const bool frameIsValid = frame.isValid();
177 m_sessionCtx.explicitNextFrameTime.reset();
178 m_sessionCtx.frames.dequeue();
181 m_sessionCtx.lastPosition.storeRelease(
182 std::max(frame.absolutePts(), lastPosition()).get());
185 m_sessionCtx.lastFrameEnd = frame.absoluteEnd();
186 m_sessionCtx.seekPos.storeRelaxed(m_sessionCtx.lastFrameEnd.get());
188 const auto loopIndex = frame.loopOffset().loopIndex;
189 if (m_sessionCtx.loopIndex < loopIndex) {
190 m_sessionCtx.loopIndex = loopIndex;
191 emit loopChanged(id(), frame.loopOffset().loopStartTimeUs, m_sessionCtx.loopIndex);
194 emit frameProcessed(std::move(frame));
196 m_sessionCtx.lastPosition.storeRelease(
197 std::max(m_sessionCtx.lastFrameEnd, lastPosition()).get());
200 m_sessionCtx.explicitNextFrameTime = SteadyClock::now() + result.recheckInterval;
203 setAtEnd(result.done && !frameIsValid);
216 const auto now = SteadyClock::now();
217 const auto pos = m_sessionCtx.timeController.positionFromTime(now);
218 m_sessionCtx.timeController.sync(now + offset, pos);
219 emit synchronized(id(), now + offset, pos);