128 const QString &description)
130 const auto prevError = std::exchange(m_prevError, error);
132 if (error != QPlatformSurfaceCapture::NoError
133 || prevError != QPlatformSurfaceCapture::NoError) {
134 emit errorUpdated(error, description);
156 qCDebug(qLcScreenCaptureGrabber) <<
"screen capture started";
158 m_context = std::make_unique<GrabbingContext>();
159 m_context->timer.setTimerType(Qt::PreciseTimer);
162 m_context->elapsedTimer.start();
164 auto doGrab = [
this]() {
165 auto measure = m_context->profiler.measure();
167 auto frame = grabFrame();
169 if (frame.isValid()) {
170 frame.setStartTime(m_context->lastFrameTime);
171 frame.setEndTime(m_context->elapsedTimer.nsecsElapsed() / 1000);
172 m_context->lastFrameTime = frame.endTime();
174 updateError(QPlatformSurfaceCapture::NoError);
176 emit frameGrabbed(frame);
182 m_context->timer.callOnTimeout(&m_context->timer, doGrab);
183 m_context->timer.start();