134 const QString &description)
136 const auto prevError = std::exchange(m_prevError, error);
138 if (error != QPlatformSurfaceCapture::NoError
139 || prevError != QPlatformSurfaceCapture::NoError) {
140 emit errorUpdated(error, description);
162 qCDebug(qLcScreenCaptureGrabber) <<
"screen capture started";
164 m_context = std::make_unique<GrabbingContext>();
165 m_context->timer.setTimerType(Qt::PreciseTimer);
168 m_context->elapsedTimer.start();
170 auto doGrab = [
this]() {
171 auto measure = m_context->profiler.measure();
173 auto frame = grabFrame();
175 if (frame.isValid()) {
176 frame.setStartTime(m_context->lastFrameTime);
177 frame.setEndTime(m_context->elapsedTimer.nsecsElapsed() / 1000);
178 m_context->lastFrameTime = frame.endTime();
180 updateError(QPlatformSurfaceCapture::NoError);
182 emit frameGrabbed(frame);
188 m_context->timer.callOnTimeout(&m_context->timer, doGrab);
189 m_context->timer.start();