From: Randell Jesup Date: Sat, 11 Jul 2020 12:31:00 +0000 Subject: Bug 1112392 - Move webrtc Tab Sharing to work in e10s/fission r=dminor Also we drop support for an independent-of-scroll/viewport capture, which the old Tab Sharing supported, for security reasons (and we don't need it). Differential Revision: https://phabricator.services.mozilla.com/D80974 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/d57a030e6e3ae9ff56f14e8cc732b0e1d3869858 --- modules/desktop_capture/desktop_capturer.cc | 11 +++++++++++ modules/desktop_capture/desktop_capturer.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/modules/desktop_capture/desktop_capturer.cc b/modules/desktop_capture/desktop_capturer.cc index 5211f1acec..4baa93cab9 100644 --- a/modules/desktop_capture/desktop_capturer.cc +++ b/modules/desktop_capture/desktop_capturer.cc @@ -101,6 +101,17 @@ std::unique_ptr DesktopCapturer::CreateScreenCapturer( return capturer; } +// static +std::unique_ptr DesktopCapturer::CreateTabCapturer( + const DesktopCaptureOptions& options) { + std::unique_ptr capturer = CreateRawTabCapturer(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"); diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h index 6909a57891..cf75004af5 100644 --- a/modules/desktop_capture/desktop_capturer.h +++ b/modules/desktop_capture/desktop_capturer.h @@ -178,6 +178,10 @@ class RTC_EXPORT DesktopCapturer { static std::unique_ptr CreateScreenCapturer( const DesktopCaptureOptions& options); + // Creates a DesktopCapturer instance which targets to capture tab. + static std::unique_ptr CreateTabCapturer( + const DesktopCaptureOptions& options); + #if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11) static bool IsRunningUnderWayland(); @@ -203,6 +207,10 @@ class RTC_EXPORT DesktopCapturer { // capture screens. static std::unique_ptr CreateRawScreenCapturer( const DesktopCaptureOptions& options); + + // Creates a DesktopCapturer instance which targets to capture tabs + static std::unique_ptr CreateRawTabCapturer( + const DesktopCaptureOptions& options); }; } // namespace webrtc -- 2.34.1