summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2018-08-07 09:15:53 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2018-08-08 09:10:39 +0000
commit410c22978c2add5f9427af08d97356d6e959e412 (patch)
treefac5631276d1d1362e663a4a177debf99deaf755 /src
parent0c01be81920123a3c3456b727efcb2e9593c65df (diff)
MediaCaptureDevicesDispatcher: Disable getDefaultScreenId on X11
Not needed and triggers race condition. Task-number: QTBUG-69007 Change-Id: Id57ba527387e5dbe44a8dd6c5a49e7278403ce64 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index 87fe543b1..7f521dd10 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -123,7 +123,16 @@ std::unique_ptr<content::MediaStreamUI> getDevicesForDesktopCapture(content::Med
content::DesktopMediaID getDefaultScreenId()
{
-#if BUILDFLAG(ENABLE_WEBRTC)
+ // While this function is executing another thread may also want to create a
+ // DesktopCapturer [1]. Unfortunately, creating a DesktopCapturer is not
+ // thread safe on X11 due to the use of webrtc::XErrorTrap. It's safe to
+ // disable this code on X11 since we don't actually need to create a
+ // DesktopCapturer to get the screen id anyway
+ // (ScreenCapturerLinux::GetSourceList always returns 0 as the id).
+ //
+ // [1]: webrtc::InProcessVideoCaptureDeviceLauncher::DoStartDesktopCaptureOnDeviceThread
+
+#if BUILDFLAG(ENABLE_WEBRTC) && !defined(USE_X11)
// Source id patterns are different across platforms.
// On Linux, the hardcoded value "0" is used.
// On Windows, the screens are enumerated consecutively in increasing order from 0.