webrtc_m130/modules/desktop_capture/desktop_capture_options.h
Olga Sharonova 52c138e36e Revert "Improve screen sharing with PipeWire on Wayland"
This reverts commit 84524e6b196153e35910111f61c36489ec2bd1d7.

Reason for revert: https://webrtc-review.googlesource.com/c/src/+/160649/33#message-a83e8959e03a274642ca2ce1abb9ea0099f08097 + suspected in breaking WebRTC to Chromium rolls https://chromium-review.googlesource.com/c/chromium/src/+/2468139

Original change's description:
> Improve screen sharing with PipeWire on Wayland
>
> Currently, sharing a screen or a window on Wayland opens unnecessary
> preview dialog on Chromium side, which is then followed by a similar
> dialog on xdg-desktop-portal side. The Chromium dialog is useless on
> Wayland, as it doesn't show anything. This is because Chromium doesn't
> have access to screen content as in case of X11 session. To fix this, we
> want to avoid showing the preview dialog in case we find that we run on
> Wayland and only pick a screen or a window from the dialog that comes
> from xdg-desktop-portal.
>
> This patch splits BaseCapturerPipeWire class, moving portal related code
> into XdgPortalBase, which does all the DBus communication and which is
> supposed to be reused by BaseCapturerPipeWire when the user confirms
> the dialog from xdg-desktop-portal. The XdgPortalBase is extended to
> support multiple calls at once, where each call is identified by Id.
>
> Relevant change on Chromium side will be in a different review.
>
> Bug: chromium:682122
> Change-Id: I2bcd07d16a5eb3b902db63ea9a164c5bd39c23a0
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187492
> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
> Reviewed-by: Tommi <tommi@webrtc.org>
> Commit-Queue: Tommi <tommi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32388}

TBR=mbonadei@webrtc.org,tommi@webrtc.org,sprang@webrtc.org,guidou@webrtc.org,mfoltz@chromium.org,grulja@gmail.com

Change-Id: I1a9748ced5626903b12214d677c7b8919c2ac385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:682122
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/188380
Reviewed-by: Olga Sharonova <olka@webrtc.org>
Commit-Queue: Olga Sharonova <olka@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32398}
2020-10-14 08:26:18 +00:00

168 lines
6.2 KiB
C++

/*
* Copyright (c) 2013 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.
*/
#ifndef MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
#define MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_
#include "api/scoped_refptr.h"
#include "rtc_base/system/rtc_export.h"
#if defined(WEBRTC_USE_X11)
#include "modules/desktop_capture/linux/shared_x_display.h"
#endif
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include "modules/desktop_capture/mac/desktop_configuration_monitor.h"
#endif
#include "modules/desktop_capture/full_screen_window_detector.h"
namespace webrtc {
// An object that stores initialization parameters for screen and window
// capturers.
class RTC_EXPORT DesktopCaptureOptions {
public:
// Returns instance of DesktopCaptureOptions with default parameters. On Linux
// also initializes X window connection. x_display() will be set to null if
// X11 connection failed (e.g. DISPLAY isn't set).
static DesktopCaptureOptions CreateDefault();
DesktopCaptureOptions();
DesktopCaptureOptions(const DesktopCaptureOptions& options);
DesktopCaptureOptions(DesktopCaptureOptions&& options);
~DesktopCaptureOptions();
DesktopCaptureOptions& operator=(const DesktopCaptureOptions& options);
DesktopCaptureOptions& operator=(DesktopCaptureOptions&& options);
#if defined(WEBRTC_USE_X11)
SharedXDisplay* x_display() const { return x_display_; }
void set_x_display(rtc::scoped_refptr<SharedXDisplay> x_display) {
x_display_ = x_display;
}
#endif
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
// TODO(zijiehe): Remove both DesktopConfigurationMonitor and
// FullScreenChromeWindowDetector out of DesktopCaptureOptions. It's not
// reasonable for external consumers to set these two parameters.
DesktopConfigurationMonitor* configuration_monitor() const {
return configuration_monitor_;
}
// If nullptr is set, ScreenCapturer won't work and WindowCapturer may return
// inaccurate result from IsOccluded() function.
void set_configuration_monitor(
rtc::scoped_refptr<DesktopConfigurationMonitor> m) {
configuration_monitor_ = m;
}
bool allow_iosurface() const { return allow_iosurface_; }
void set_allow_iosurface(bool allow) { allow_iosurface_ = allow; }
#endif
FullScreenWindowDetector* full_screen_window_detector() const {
return full_screen_window_detector_;
}
void set_full_screen_window_detector(
rtc::scoped_refptr<FullScreenWindowDetector> detector) {
full_screen_window_detector_ = detector;
}
// Flag indicating that the capturer should use screen change notifications.
// Enables/disables use of XDAMAGE in the X11 capturer.
bool use_update_notifications() const { return use_update_notifications_; }
void set_use_update_notifications(bool use_update_notifications) {
use_update_notifications_ = use_update_notifications;
}
// Flag indicating if desktop effects (e.g. Aero) should be disabled when the
// capturer is active. Currently used only on Windows.
bool disable_effects() const { return disable_effects_; }
void set_disable_effects(bool disable_effects) {
disable_effects_ = disable_effects;
}
// Flag that should be set if the consumer uses updated_region() and the
// capturer should try to provide correct updated_region() for the frames it
// generates (e.g. by comparing each frame with the previous one).
bool detect_updated_region() const { return detect_updated_region_; }
void set_detect_updated_region(bool detect_updated_region) {
detect_updated_region_ = detect_updated_region;
}
#if defined(WEBRTC_WIN)
bool allow_use_magnification_api() const {
return allow_use_magnification_api_;
}
void set_allow_use_magnification_api(bool allow) {
allow_use_magnification_api_ = allow;
}
// Allowing directx based capturer or not, this capturer works on windows 7
// with platform update / windows 8 or upper.
bool allow_directx_capturer() const { return allow_directx_capturer_; }
void set_allow_directx_capturer(bool enabled) {
allow_directx_capturer_ = enabled;
}
// Flag that may be set to allow use of the cropping window capturer (which
// captures the screen & crops that to the window region in some cases). An
// advantage of using this is significantly higher capture frame rates than
// capturing the window directly. A disadvantage of using this is the
// possibility of capturing unrelated content (e.g. overlapping windows that
// aren't detected properly, or neighboring regions when moving/resizing the
// captured window). Note: this flag influences the behavior of calls to
// DesktopCapturer::CreateWindowCapturer; calls to
// CroppingWindowCapturer::CreateCapturer ignore the flag (treat it as true).
bool allow_cropping_window_capturer() const {
return allow_cropping_window_capturer_;
}
void set_allow_cropping_window_capturer(bool allow) {
allow_cropping_window_capturer_ = allow;
}
#endif
#if defined(WEBRTC_USE_PIPEWIRE)
bool allow_pipewire() const { return allow_pipewire_; }
void set_allow_pipewire(bool allow) { allow_pipewire_ = allow; }
#endif
private:
#if defined(WEBRTC_USE_X11)
rtc::scoped_refptr<SharedXDisplay> x_display_;
#endif
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
rtc::scoped_refptr<DesktopConfigurationMonitor> configuration_monitor_;
bool allow_iosurface_ = false;
#endif
rtc::scoped_refptr<FullScreenWindowDetector> full_screen_window_detector_;
#if defined(WEBRTC_WIN)
bool allow_use_magnification_api_ = false;
bool allow_directx_capturer_ = false;
bool allow_cropping_window_capturer_ = false;
#endif
#if defined(WEBRTC_USE_X11)
bool use_update_notifications_ = false;
#else
bool use_update_notifications_ = true;
#endif
bool disable_effects_ = true;
bool detect_updated_region_ = false;
#if defined(WEBRTC_USE_PIPEWIRE)
bool allow_pipewire_ = false;
#endif
};
} // namespace webrtc
#endif // MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_OPTIONS_H_