window_capturer_linux.cc (1724B)
1 /* 2 * Copyright 2018 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include <memory> 12 13 #include "modules/desktop_capture/desktop_capture_options.h" 14 #include "modules/desktop_capture/desktop_capture_types.h" 15 #include "modules/desktop_capture/desktop_capturer.h" 16 #include "rtc_base/logging.h" 17 18 #if defined(WEBRTC_USE_PIPEWIRE) 19 #include "modules/desktop_capture/linux/wayland/base_capturer_pipewire.h" 20 #endif // defined(WEBRTC_USE_PIPEWIRE) 21 22 #if defined(WEBRTC_USE_X11) 23 #include "modules/desktop_capture/linux/x11/window_capturer_x11.h" 24 #endif // defined(WEBRTC_USE_X11) 25 26 namespace webrtc { 27 28 // static 29 std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer( 30 const DesktopCaptureOptions& options) { 31 #if defined(WEBRTC_USE_PIPEWIRE) 32 if (options.allow_pipewire() && BaseCapturerPipeWire::IsSupported()) { 33 RTC_LOG(LS_INFO) 34 << "video capture: DesktopCapturer::CreateRawWindowCapturer creates " 35 "DesktopCapturer of type BaseCapturerPipeWire"; 36 return std::make_unique<BaseCapturerPipeWire>(options, 37 CaptureType::kWindow); 38 } 39 #endif // defined(WEBRTC_USE_PIPEWIRE) 40 41 #if defined(WEBRTC_USE_X11) 42 if (!DesktopCapturer::IsRunningUnderWayland()) 43 return WindowCapturerX11::CreateRawWindowCapturer(options); 44 #endif // defined(WEBRTC_USE_X11) 45 46 return nullptr; 47 } 48 49 } // namespace webrtc