diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-02-09 21:42:15 +0100 |
---|---|---|
committer | Artem Dyomin <artem.dyomin@qt.io> | 2023-02-12 13:08:19 +0100 |
commit | fc079734d34747d64fa26645bda36699b26c047e (patch) | |
tree | 526ab26efb8732459d291772b570783c2707ee73 /src/multimedia/platform | |
parent | f10828d0fe99a2dddd158c25a0a140d8af4e82eb (diff) |
Implement custom X11 screen capturing
The implementation works on linux with run X11. It's disabled with wayland.
Achivements
- Fixed problem with performance.
The standard implementation affected CPU too much.
On my local release build the speedup
in capturing of a single frame is 4-5 times.
The explanation of such a huge difference is that opening of capturing
contexts on X11 is an expensive action, whereas implemented single
context allocation and transferring images through
shared memory (Xshm) is pretty fast.
Also, QScreen::grabWindow permorms additional pixels processings
under the hood what is not needed for videoframes.
- Improved errors handling
- The patch allows to run screen capture backend UTs on linux CI
with X11, namely, ubuntu, opensuse. Test results:
https://testresults.qt.io/coin/integration/qt/qtmultimedia/tasks/web_qt_qtmultimedia_1675977558004
- Probably, fixed problem with windows overlaping, the matching
tests became pass, it should be checked on different platforms.
Also, the approach cannot capture windows
out of the screen borders, we throw an error signal.
Both windows issues are to be investigated deeper in 6.6.
With the next commits I might move some common threading code for
SC to a separate class.
Task-number: QTBUG-103226
Pick-to: 6.5
Change-Id: Ibd3600fdbc9714f14dc80c2a330aea5e0d064791
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/multimedia/platform')
-rw-r--r-- | src/multimedia/platform/qplatformscreencapture.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/multimedia/platform/qplatformscreencapture.cpp b/src/multimedia/platform/qplatformscreencapture.cpp index ed2003b25..57ff87029 100644 --- a/src/multimedia/platform/qplatformscreencapture.cpp +++ b/src/multimedia/platform/qplatformscreencapture.cpp @@ -59,10 +59,11 @@ void QPlatformScreenCapture::updateError(QScreenCapture::Error error, const QStr m_error = error; m_errorString = errorString; if (changed) { - qWarning() << "Screen capture fail:" << error << "," << errorString; - if (m_error != QScreenCapture::NoError) emit m_screenCapture->errorOccurred(error, errorString); + else + qWarning() << "Screen capture fail:" << error << "," << errorString; + emit m_screenCapture->errorChanged(); } } |