127 const QString &description)
129 const auto prevError = std::exchange(m_prevError, error);
131 if (error != QPlatformSurfaceCapture::NoError
132 || prevError != QPlatformSurfaceCapture::NoError) {
133 emit errorUpdated(error, description);
152 qCDebug(qLcScreenCaptureGrabber) <<
"screen capture started";
154 m_context = std::make_unique<GrabbingContext>();
155 m_context->timer.setTimerType(Qt::PreciseTimer);
158 m_context->elapsedTimer.start();
160 auto doGrab = [
this]() {
161 auto measure = m_context->profiler.measure();
163 auto frame = grabFrame();
165 if (frame.isValid()) {
166 frame.setStartTime(m_context->lastFrameTime);
167 frame.setEndTime(m_context->elapsedTimer.nsecsElapsed() / 1000);
168 m_context->lastFrameTime = frame.endTime();
170 updateError(QPlatformSurfaceCapture::NoError);
172 emit frameGrabbed(frame);
178 m_context->timer.callOnTimeout(&m_context->timer, doGrab);
179 m_context->timer.start();