17QVideoFrame QAndroidVideoFrameFactory::createVideoFrame(QtJniTypes::Image frame,
18 QtVideo::Rotation rotation)
20 const int currentCounter = m_framesCounter.fetch_add(1, std::memory_order_relaxed) + 1;
22 auto frameAdapter = std::make_unique<QAndroidVideoFrameBuffer>(
25 currentCounter > NATIVE_FRAME_LIMIT ?
26 QAndroidVideoFrameBuffer::MemoryPolicy::Copy
27 : QAndroidVideoFrameBuffer::MemoryPolicy::Reuse,
30 if (!frameAdapter->isParsed())
33 const qint64 currentTimeStamp = frameAdapter->timestamp();
34 QVideoFrame videoFrame(std::move(frameAdapter));
36 if (m_lastTimestamp == 0)
37 m_lastTimestamp = currentTimeStamp;
39 videoFrame.setStartTime(m_lastTimestamp);
40 videoFrame.setEndTime(currentTimeStamp);
42 m_lastTimestamp = currentTimeStamp;