
This reverts commit 0098a441e3990f80bcbe05dfce8c6e2359f7ef25. Reason for revert: Fix chromium build break Original change's description: > Revert "Add plumbing to control PipeWire picker visibility" > > This reverts commit fbea8c519684577a38cb35b9287ba4645a905094. > > Reason for revert: Breaks WebRTC import into Chromium, e.g: > https://chromium-review.googlesource.com/c/chromium/src/+/3863998/ > > Original change's description: > > Add plumbing to control PipeWire picker visibility > > > > Introduces the notion of a "delegated source list" and corresponding > > controller. This is used by desktop capturers (currently just the > > PipeWire capturer), who control selecting the source through their own > > (often system-level) UI, rather than returning a source list with all > > available options that can then be selected by the embedder. > > > > Adds a method to get the controller which serves to also tell embedders > > if the capturer makes use of a delegated source list. The controller > > currently allows the embedder to request that the delegated source list > > be shown or hidden, and will in the future be used to expose events > > from the source list (e.g. selection, dismissal, error). > > > > Bug: chromium:1351572 > > Change-Id: Ie1d36ed654013f59b8d9095deef01a4705fd5bde > > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272621 > > Reviewed-by: Mark Foltz <mfoltz@chromium.org> > > Commit-Queue: Alexander Cooper <alcooper@chromium.org> > > Cr-Commit-Position: refs/heads/main@{#37956} > > Bug: chromium:1351572 > Change-Id: I06f76ab9c8bc1aa303dae177d48698951fdc5ecd > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273703 > Auto-Submit: Henrik Boström <hbos@webrtc.org> > Reviewed-by: Henrik Andreassson <henrika@webrtc.org> > Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com> > Reviewed-by: Henrik Boström <hbos@webrtc.org> > Commit-Queue: Henrik Andreassson <henrika@webrtc.org> > Cr-Commit-Position: refs/heads/main@{#37964} Bug: chromium:1351572 Change-Id: I9e5e691746b81517bf0e211d0ad5a23371ab29ba Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/273685 Reviewed-by: Mark Foltz <mfoltz@chromium.org> Auto-Submit: Alexander Cooper <alcooper@chromium.org> Commit-Queue: Mark Foltz <mfoltz@chromium.org> Cr-Commit-Position: refs/heads/main@{#37972}
112 lines
3.2 KiB
C++
112 lines
3.2 KiB
C++
/*
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "modules/desktop_capture/desktop_capturer.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <cstring>
|
|
#include <utility>
|
|
|
|
#include "modules/desktop_capture/cropping_window_capturer.h"
|
|
#include "modules/desktop_capture/desktop_capture_options.h"
|
|
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
|
|
|
|
#if defined(RTC_ENABLE_WIN_WGC)
|
|
#include "modules/desktop_capture/win/wgc_capturer_win.h"
|
|
#include "rtc_base/win/windows_version.h"
|
|
#endif // defined(RTC_ENABLE_WIN_WGC)
|
|
|
|
namespace webrtc {
|
|
|
|
DesktopCapturer::~DesktopCapturer() = default;
|
|
|
|
DelegatedSourceListController*
|
|
DesktopCapturer::GetDelegatedSourceListController() {
|
|
return nullptr;
|
|
}
|
|
|
|
void DesktopCapturer::SetSharedMemoryFactory(
|
|
std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
|
|
|
|
void DesktopCapturer::SetExcludedWindow(WindowId window) {}
|
|
|
|
bool DesktopCapturer::GetSourceList(SourceList* sources) {
|
|
return true;
|
|
}
|
|
|
|
bool DesktopCapturer::SelectSource(SourceId id) {
|
|
return false;
|
|
}
|
|
|
|
bool DesktopCapturer::FocusOnSelectedSource() {
|
|
return false;
|
|
}
|
|
|
|
bool DesktopCapturer::IsOccluded(const DesktopVector& pos) {
|
|
return false;
|
|
}
|
|
|
|
// static
|
|
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
|
|
const DesktopCaptureOptions& options) {
|
|
#if defined(RTC_ENABLE_WIN_WGC)
|
|
if (options.allow_wgc_capturer() && IsWgcSupported(CaptureType::kWindow)) {
|
|
return WgcCapturerWin::CreateRawWindowCapturer(options);
|
|
}
|
|
#endif // defined(RTC_ENABLE_WIN_WGC)
|
|
|
|
#if defined(WEBRTC_WIN)
|
|
if (options.allow_cropping_window_capturer()) {
|
|
return CroppingWindowCapturer::CreateCapturer(options);
|
|
}
|
|
#endif // defined(WEBRTC_WIN)
|
|
|
|
std::unique_ptr<DesktopCapturer> capturer = CreateRawWindowCapturer(options);
|
|
if (capturer && options.detect_updated_region()) {
|
|
capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
|
}
|
|
|
|
return capturer;
|
|
}
|
|
|
|
// static
|
|
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
|
|
const DesktopCaptureOptions& options) {
|
|
#if defined(RTC_ENABLE_WIN_WGC)
|
|
if (options.allow_wgc_capturer() && IsWgcSupported(CaptureType::kScreen)) {
|
|
return WgcCapturerWin::CreateRawScreenCapturer(options);
|
|
}
|
|
#endif // defined(RTC_ENABLE_WIN_WGC)
|
|
|
|
std::unique_ptr<DesktopCapturer> capturer = CreateRawScreenCapturer(options);
|
|
if (capturer && options.detect_updated_region()) {
|
|
capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
|
}
|
|
|
|
return capturer;
|
|
}
|
|
|
|
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
|
bool DesktopCapturer::IsRunningUnderWayland() {
|
|
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
|
if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0)
|
|
return false;
|
|
|
|
if (!(getenv("WAYLAND_DISPLAY")))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
|
|
|
} // namespace webrtc
|