summaryrefslogtreecommitdiff
path: root/firefox-pipewire.patch
diff options
context:
space:
mode:
authorJan Grulich <jgrulich@redhat.com>2019-01-30 14:03:47 +0100
committerJan Grulich <jgrulich@redhat.com>2019-01-30 14:03:47 +0100
commitb93a84ed3cc040fa80645382b1e241feefb57e40 (patch)
treecbdb1c98b7727e4d16ffa21b1eaac00ff9b9ca46 /firefox-pipewire.patch
parentRemoved unused mozilla-1435212-ffmpeg-4.0.patch (diff)
downloadlibrewolf-fedora-ff-b93a84ed3cc040fa80645382b1e241feefb57e40.tar.gz
librewolf-fedora-ff-b93a84ed3cc040fa80645382b1e241feefb57e40.tar.bz2
librewolf-fedora-ff-b93a84ed3cc040fa80645382b1e241feefb57e40.zip
Re-enable PipeWire support
Diffstat (limited to 'firefox-pipewire.patch')
-rw-r--r--firefox-pipewire.patch635
1 files changed, 317 insertions, 318 deletions
diff --git a/firefox-pipewire.patch b/firefox-pipewire.patch
index fd1906d..4ac52d2 100644
--- a/firefox-pipewire.patch
+++ b/firefox-pipewire.patch
@@ -1,7 +1,8 @@
-diff -ENwbur firefox-64.0/config/system-headers.mozbuild firefox-webrtc/config/system-headers.mozbuild
---- firefox-64.0/config/system-headers.mozbuild 2019-01-07 13:18:29.367461827 +0100
-+++ firefox-webrtc/config/system-headers.mozbuild 2019-01-07 13:19:30.043067979 +0100
-@@ -314,6 +314,7 @@
+diff --git a/config/system-headers.mozbuild b/config/system-headers.mozbuild
+index b257e6f8e3..aa58a7fe58 100644
+--- a/config/system-headers.mozbuild
++++ b/config/system-headers.mozbuild
+@@ -314,6 +314,7 @@ system_headers = [
'Gestalt.h',
'getopt.h',
'gio/gio.h',
@@ -9,7 +10,7 @@ diff -ENwbur firefox-64.0/config/system-headers.mozbuild firefox-webrtc/config/s
'glibconfig.h',
'glib.h',
'glib-object.h',
-@@ -607,6 +608,7 @@
+@@ -607,6 +608,7 @@ system_headers = [
'Pgenerr.h',
'PGenErr.h',
'Ph.h',
@@ -17,9 +18,11 @@ diff -ENwbur firefox-64.0/config/system-headers.mozbuild firefox-webrtc/config/s
'pixman.h',
'pk11func.h',
'pk11pqg.h',
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc 2019-01-07 13:20:40.141768272 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc
+new file mode 100644
+index 0000000000..508b695540
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
@@ -31,11 +34,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
+
+#if defined(USE_X11)
-+#include "webrtc/modules/desktop_capture/app_capturer_x11.h"
++#include "modules/desktop_capture/app_capturer_x11.h"
+#endif // defined(USE_X11)
+
+namespace webrtc {
@@ -60,32 +63,32 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc 2019-01-07 13:16:46.374432920 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc 2019-01-07 13:20:40.142768282 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc
+index 5cbd143556..95d816f973 100755
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc
@@ -7,9 +7,6 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
--#include "webrtc/modules/desktop_capture/app_capturer.h"
--#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
--#include "webrtc/modules/desktop_capture/x11/shared_x_util.h"
+-#include "modules/desktop_capture/app_capturer.h"
+-#include "modules/desktop_capture/shared_desktop_frame.h"
+-#include "modules/desktop_capture/x11/shared_x_util.h"
#include <assert.h>
#include <string.h>
-@@ -21,80 +18,19 @@
+@@ -21,80 +18,18 @@
#include <algorithm>
-+#include "webrtc/modules/desktop_capture/app_capturer_x11.h"
-+
- #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
- #include "webrtc/modules/desktop_capture/desktop_frame.h"
- #include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
-+#include "webrtc/modules/desktop_capture/x11/shared_x_util.h"
- #include "webrtc/modules/desktop_capture/x11/x_error_trap.h"
- #include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
- #include "webrtc/system_wrappers/include/logging.h"
++#include "modules/desktop_capture/app_capturer_x11.h"
+ #include "modules/desktop_capture/desktop_capture_options.h"
+ #include "modules/desktop_capture/desktop_frame.h"
+ #include "modules/desktop_capture/x11/shared_x_display.h"
++#include "modules/desktop_capture/x11/shared_x_util.h"
+ #include "modules/desktop_capture/x11/x_error_trap.h"
+ #include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
+ #include "rtc_base/logging.h"
namespace webrtc {
@@ -158,7 +161,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
: callback_(NULL),
selected_process_(0),
x_display_(options.x_display()) {
-@@ -103,7 +39,7 @@
+@@ -103,7 +38,7 @@ AppCapturerLinux::AppCapturerLinux(const DesktopCaptureOptions& options)
rgn_background_ = XCreateRegion();
}
@@ -167,7 +170,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
if (rgn_mask_) {
XDestroyRegion(rgn_mask_);
}
-@@ -116,32 +52,32 @@
+@@ -116,32 +51,32 @@ AppCapturerLinux::~AppCapturerLinux() {
}
// AppCapturer interface.
@@ -206,7 +209,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
XErrorTrap error_trap(GetDisplay());
//Capture screen >> set root window as capture window
-@@ -169,7 +105,7 @@
+@@ -169,7 +104,7 @@ void AppCapturerLinux::CaptureFrame() {
}
}
@@ -215,7 +218,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
XErrorTrap error_trap(GetDisplay());
if (!pDesktopFrame) {
-@@ -192,7 +128,7 @@
+@@ -192,7 +127,7 @@ void AppCapturerLinux::FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFra
}
}
@@ -224,7 +227,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
XErrorTrap error_trap(GetDisplay());
XSubtractRegion(rgn_visual_, rgn_visual_, rgn_visual_);
-@@ -269,21 +205,19 @@
+@@ -269,21 +204,19 @@ bool AppCapturerLinux::UpdateRegions() {
return true;
}
@@ -250,9 +253,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
return std::unique_ptr<DesktopCapturer>(std::move(capturer));
}
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h 2019-01-07 13:20:40.203768892 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h
+new file mode 100644
+index 0000000000..2b3d0dc0ad
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -272,15 +277,15 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
+#include <memory>
+#include <string>
+
-+#include "webrtc/modules/desktop_capture/app_capturer.h"
-+#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
-+#include "webrtc/modules/desktop_capture/desktop_geometry.h"
-+#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
-+#include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
-+#include "webrtc/base/constructormagic.h"
-+#include "webrtc/base/scoped_ref_ptr.h"
++#include "modules/desktop_capture/app_capturer.h"
++#include "modules/desktop_capture/shared_desktop_frame.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_geometry.h"
++#include "modules/desktop_capture/x11/shared_x_display.h"
++#include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
++#include "rtc_base/constructormagic.h"
++#include "rtc_base/scoped_ref_ptr.h"
+
+namespace webrtc {
+
@@ -352,9 +357,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_APP_CAPTURER_X11_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc 2019-01-07 13:20:40.143768292 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc
+new file mode 100644
+index 0000000000..47350149f4
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc
@@ -0,0 +1,849 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -375,12 +382,12 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+#include <spa/param/video/raw-utils.h>
+#include <spa/support/type-map.h>
+
-+#include "webrtc/modules/desktop_capture/base_capturer_pipewire.h"
++#include "modules/desktop_capture/base_capturer_pipewire.h"
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
-+#include "webrtc/base/checks.h"
-+#include "webrtc/base/logging.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
++#include "rtc_base/checks.h"
++#include "rtc_base/logging.h"
+
+namespace webrtc {
+
@@ -404,17 +411,17 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+
+ switch (state) {
+ case PW_REMOTE_STATE_ERROR:
-+ LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
++ RTC_LOG(LS_ERROR) << "PipeWire remote state error: " << error_message;
+ break;
+ case PW_REMOTE_STATE_CONNECTED:
-+ LOG(LS_INFO) << "PipeWire remote state: connected.";
++ RTC_LOG(LS_INFO) << "PipeWire remote state: connected.";
+ that->CreateReceivingStream();
+ break;
+ case PW_REMOTE_STATE_CONNECTING:
-+ LOG(LS_INFO) << "PipeWire remote state: connecting.";
++ RTC_LOG(LS_INFO) << "PipeWire remote state: connecting.";
+ break;
+ case PW_REMOTE_STATE_UNCONNECTED:
-+ LOG(LS_INFO) << "PipeWire remote state: unconnected.";
++ RTC_LOG(LS_INFO) << "PipeWire remote state: unconnected.";
+ break;
+ }
+}
@@ -429,7 +436,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+
+ switch (state) {
+ case PW_STREAM_STATE_ERROR:
-+ LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
++ RTC_LOG(LS_ERROR) << "PipeWire stream state error: " << error_message;
+ break;
+ case PW_STREAM_STATE_CONFIGURE:
+ pw_stream_set_active(that->pw_stream_, true);
@@ -450,7 +457,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ BaseCapturerPipeWire* that = static_cast<BaseCapturerPipeWire*>(data);
+ RTC_DCHECK(that);
+
-+ LOG(LS_INFO) << "PipeWire stream format changed.";
++ RTC_LOG(LS_INFO) << "PipeWire stream format changed.";
+
+ if (!format) {
+ pw_stream_finish_format(that->pw_stream_, /*res=*/0, /*params=*/nullptr,
@@ -581,7 +588,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ G_DBUS_SEND_MESSAGE_FLAGS_NONE,
+ /*out_serial=*/nullptr, &error);
+ if (error) {
-+ LOG(LS_ERROR) << "Failed to close the session: " << error->message;
++ RTC_LOG(LS_ERROR) << "Failed to close the session: " << error->message;
+ g_error_free(error);
+ }
+ g_object_unref(message);
@@ -632,7 +639,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ pw_remote_connect_fd(pw_remote_, pw_fd_);
+
+ if (pw_thread_loop_start(pw_main_loop_) < 0) {
-+ LOG(LS_ERROR) << "Failed to start main PipeWire loop";
++ RTC_LOG(LS_ERROR) << "Failed to start main PipeWire loop";
+ portal_init_failed_ = true;
+ }
+}
@@ -696,7 +703,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ if (pw_stream_connect(pw_stream_, PW_DIRECTION_INPUT, /*port_path=*/nullptr,
+ flags, params,
+ /*n_params=*/1) != 0) {
-+ LOG(LS_ERROR) << "Could not connect receiving stream.";
++ RTC_LOG(LS_ERROR) << "Could not connect receiving stream.";
+ portal_init_failed_ = true;
+ return;
+ }
@@ -713,7 +720,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ uint32_t maxSize = spaBuffer->datas[0].maxsize;
+ int32_t srcStride = spaBuffer->datas[0].chunk->stride;
+ if (srcStride != (desktop_size_.width() * kBytesPerPixelPw)) {
-+ LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
++ RTC_LOG(LS_ERROR) << "Got buffer with stride different from screen stride: "
+ << srcStride
+ << " != " << (desktop_size_.width() * kBytesPerPixelPw);
+ portal_init_failed_ = true;
@@ -768,7 +775,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GError* error = nullptr;
+ that->proxy_ = g_dbus_proxy_new_finish(result, &error);
+ if (!that->proxy_) {
-+ LOG(LS_ERROR) << "Failed to create a proxy for the screen cast portal: "
++ RTC_LOG(LS_ERROR) << "Failed to create a proxy for the screen cast portal: "
+ << error->message;
+ g_error_free(error);
+ that->portal_init_failed_ = true;
@@ -776,7 +783,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ }
+ that->connection_ = g_dbus_proxy_get_connection(that->proxy_);
+
-+ LOG(LS_INFO) << "Created proxy for the screen cast portal.";
++ RTC_LOG(LS_INFO) << "Created proxy for the screen cast portal.";
+ that->SessionRequest();
+}
+
@@ -816,7 +823,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ portal_handle_, OnSessionRequestResponseSignal);
+ g_free(variant_string);
+
-+ LOG(LS_INFO) << "Screen cast session requested.";
++ RTC_LOG(LS_INFO) << "Screen cast session requested.";
+ g_dbus_proxy_call(
+ proxy_, "CreateSession", g_variant_new("(a{sv})", &builder),
+ G_DBUS_CALL_FLAGS_NONE, /*timeout=*/-1, /*cancellable=*/nullptr,
@@ -834,19 +841,19 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GError* error = nullptr;
+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error);
+ if (!variant) {
-+ LOG(LS_ERROR) << "Failed to create a screen cast session: "
++ RTC_LOG(LS_ERROR) << "Failed to create a screen cast session: "
+ << error->message;
+ g_error_free(error);
+ that->portal_init_failed_ = true;
+ return;
+ }
-+ LOG(LS_INFO) << "Initializing the screen cast session.";
++ RTC_LOG(LS_INFO) << "Initializing the screen cast session.";
+
+ gchar* handle = nullptr;
+ g_variant_get_child(variant, 0, "o", &handle);
+ g_variant_unref(variant);
+ if (!handle) {
-+ LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
++ RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
+ if (that->session_request_signal_id_) {
+ g_dbus_connection_signal_unsubscribe(connection,
+ that->session_request_signal_id_);
@@ -858,7 +865,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+
+ g_free(handle);
+
-+ LOG(LS_INFO) << "Subscribing to the screen cast session.";
++ RTC_LOG(LS_INFO) << "Subscribing to the screen cast session.";
+}
+
+// static
@@ -875,7 +882,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ RTC_DCHECK(that);
+
+
-+ LOG(LS_INFO)
++ RTC_LOG(LS_INFO)
+ << "Received response for the screen cast session subscription.";
+
+ guint32 portal_response;
@@ -886,7 +893,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ g_variant_unref(response_data);
+
+ if (!that->session_handle_ || portal_response) {
-+ LOG(LS_ERROR)
++ RTC_LOG(LS_ERROR)
+ << "Failed to request the screen cast session subscription.";
+ that->portal_init_failed_ = true;
+ return;
@@ -915,7 +922,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ sources_handle_, OnSourcesRequestResponseSignal);
+ g_free(variant_string);
+
-+ LOG(LS_INFO) << "Requesting sources from the screen cast session.";
++ RTC_LOG(LS_INFO) << "Requesting sources from the screen cast session.";
+ g_dbus_proxy_call(
+ proxy_, "SelectSources",
+ g_variant_new("(oa{sv})", session_handle_, &builder),
@@ -934,19 +941,19 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GError* error = nullptr;
+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error);
+ if (!variant) {
-+ LOG(LS_ERROR) << "Failed to request the sources: " << error->message;
++ RTC_LOG(LS_ERROR) << "Failed to request the sources: " << error->message;
+ g_error_free(error);
+ that->portal_init_failed_ = true;
+ return;
+ }
+
-+ LOG(LS_INFO) << "Sources requested from the screen cast session.";
++ RTC_LOG(LS_INFO) << "Sources requested from the screen cast session.";
+
+ gchar* handle = nullptr;
+ g_variant_get_child(variant, 0, "o", &handle);
+ g_variant_unref(variant);
+ if (!handle) {
-+ LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
++ RTC_LOG(LS_ERROR) << "Failed to initialize the screen cast session.";
+ if (that->sources_request_signal_id_) {
+ g_dbus_connection_signal_unsubscribe(connection,
+ that->sources_request_signal_id_);
@@ -958,7 +965,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+
+ g_free(handle);
+
-+ LOG(LS_INFO) << "Subscribed to sources signal.";
++ RTC_LOG(LS_INFO) << "Subscribed to sources signal.";
+}
+
+// static
@@ -977,13 +984,13 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ guint32 portal_response;
+ g_variant_get(parameters, "(u@a{sv})", &portal_response, nullptr);
+ if (portal_response) {
-+ LOG(LS_ERROR)
++ RTC_LOG(LS_ERROR)
+ << "Failed to select sources for the screen cast session.";
+ that->portal_init_failed_ = true;
+ return;
+ }
+
-+ LOG(LS_INFO) << "Received sources signal from session.";
++ RTC_LOG(LS_INFO) << "Received sources signal from session.";
+ that->StartRequest();
+}
+
@@ -1004,7 +1011,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ // "Identifier for the application window", this is Wayland, so not "x11:...".
+ const gchar parent_window[] = "";
+
-+ LOG(LS_INFO) << "Starting the screen cast session.";
++ RTC_LOG(LS_INFO) << "Starting the screen cast session.";
+ g_dbus_proxy_call(
+ proxy_, "Start",
+ g_variant_new("(osa{sv})", session_handle_, parent_window, &builder),
@@ -1023,20 +1030,20 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GError* error = nullptr;
+ GVariant* variant = g_dbus_proxy_call_finish(that->proxy_, result, &error);
+ if (!variant) {
-+ LOG(LS_ERROR) << "Failed to start the screen cast session: "
++ RTC_LOG(LS_ERROR) << "Failed to start the screen cast session: "
+ << error->message;
+ g_error_free(error);
+ that->portal_init_failed_ = true;
+ return;
+ }
+
-+ LOG(LS_INFO) << "Initializing the start of the screen cast session.";
++ RTC_LOG(LS_INFO) << "Initializing the start of the screen cast session.";
+
+ gchar* handle = nullptr;
+ g_variant_get_child(variant, 0, "o", &handle);
+ g_variant_unref(variant);
+ if (!handle) {
-+ LOG(LS_ERROR)
++ RTC_LOG(LS_ERROR)
+ << "Failed to initialize the start of the screen cast session.";
+ if (that->start_request_signal_id_) {
+ g_dbus_connection_signal_unsubscribe(connection,
@@ -1049,7 +1056,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+
+ g_free(handle);
+
-+ LOG(LS_INFO) << "Subscribed to the start signal.";
++ RTC_LOG(LS_INFO) << "Subscribed to the start signal.";
+}
+
+// static
@@ -1065,13 +1072,13 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ static_cast<BaseCapturerPipeWire*>(user_data);
+ RTC_DCHECK(that);
+
-+ LOG(LS_INFO) << "Start signal received.";
++ RTC_LOG(LS_INFO) << "Start signal received.";
+ guint32 portal_response;
+ GVariant* response_data;
+ GVariantIter* iter = nullptr;
+ g_variant_get(parameters, "(u@a{sv})", &portal_response, &response_data);
+ if (portal_response || !response_data) {
-+ LOG(LS_ERROR) << "Failed to start the screen cast session.";
++ RTC_LOG(LS_ERROR) << "Failed to start the screen cast session.";
+ that->portal_init_failed_ = true;
+ return;
+ }
@@ -1109,7 +1116,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GVariantBuilder builder;
+ g_variant_builder_init(&builder, G_VARIANT_TYPE_VARDICT);
+
-+ LOG(LS_INFO) << "Opening the PipeWire remote.";
++ RTC_LOG(LS_INFO) << "Opening the PipeWire remote.";
+
+ g_dbus_proxy_call_with_unix_fd_list(
+ proxy_, "OpenPipeWireRemote",
@@ -1134,7 +1141,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ GVariant* variant = g_dbus_proxy_call_with_unix_fd_list_finish(
+ that->proxy_, &outlist, result, &error);
+ if (!variant) {
-+ LOG(LS_ERROR) << "Failed to open the PipeWire remote: "
++ RTC_LOG(LS_ERROR) << "Failed to open the PipeWire remote: "
+ << error->message;
+ g_error_free(error);
+ that->portal_init_failed_ = true;
@@ -1145,7 +1152,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ g_variant_get(variant, "(h)", &index);
+
+ if ((that->pw_fd_ = g_unix_fd_list_get(outlist, index, &error)) == -1) {
-+ LOG(LS_ERROR) << "Failed to get file descriptor from the list: "
++ RTC_LOG(LS_ERROR) << "Failed to get file descriptor from the list: "
+ << error->message;
+ g_error_free(error);
+ g_variant_unref(variant);
@@ -1157,7 +1164,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+ g_object_unref(outlist);
+
+ that->InitPipeWire();
-+ LOG(LS_INFO) << "PipeWire remote opened.";
++ RTC_LOG(LS_INFO) << "PipeWire remote opened.";
+}
+
+void BaseCapturerPipeWire::Start(Callback* callback) {
@@ -1205,9 +1212,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h 2019-01-07 13:20:40.141768272 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h
+new file mode 100644
+index 0000000000..3841938bd7
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -1227,8 +1236,8 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+#include <pipewire/pipewire.h>
+#include <spa/param/video/format-utils.h>
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
+
+namespace webrtc {
+
@@ -1376,22 +1385,26 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_BASE_CAPTURER_PIPEWIRE_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build 2019-01-07 13:16:46.410433280 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_gn/moz.build 2019-01-07 13:20:40.146768322 +0100
-@@ -143,14 +143,26 @@
- "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
- ]
-
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
+index e8421fc3d3..6be802e0b4 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
+@@ -152,10 +152,10 @@ if CONFIG["OS_TARGET"] == "FreeBSD":
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
+ ]
+
+# Common Linux stuff between X11 and PipeWire
- if CONFIG["OS_TARGET"] == "Linux":
-
- DEFINES["USE_NSS_CERTS"] = "1"
-- DEFINES["USE_X11"] = "1"
- DEFINES["WEBRTC_LINUX"] = True
- DEFINES["WEBRTC_POSIX"] = True
- DEFINES["_FILE_OFFSET_BITS"] = "64"
-
+ if CONFIG["OS_TARGET"] == "Linux":
+
+ DEFINES["USE_NSS_CERTS"] = "1"
+- DEFINES["USE_X11"] = "1"
+ DEFINES["WEBRTC_LINUX"] = True
+ DEFINES["WEBRTC_POSIX"] = True
+ DEFINES["_FILE_OFFSET_BITS"] = "64"
+@@ -174,6 +174,18 @@ if CONFIG["OS_TARGET"] == "Linux":
+ "Xrender"
+ ]
+
+ UNIFIED_SOURCES += [
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc",
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc",
@@ -1404,13 +1417,13 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
+
+ DEFINES["USE_X11"] = "1"
+
- OS_LIBS += [
- "rt",
- "X11",
-@@ -177,6 +189,27 @@
- "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
- ]
-
+ UNIFIED_SOURCES += [
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc",
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc",
+@@ -189,6 +201,27 @@ if CONFIG["OS_TARGET"] == "Linux":
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
+ ]
+
+# PipeWire specific files
+if CONFIG["OS_TARGET"] == "Linux":
+
@@ -1432,13 +1445,14 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc"
+ ]
+
- if CONFIG["OS_TARGET"] == "NetBSD":
-
- DEFINES["USE_X11"] = "1"
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2019-01-07 13:16:46.361432790 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2019-01-07 13:20:40.144768302 +0100
-@@ -107,6 +107,11 @@
+ if CONFIG["OS_TARGET"] == "NetBSD":
+
+ DEFINES["USE_X11"] = "1"
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
+index fec5ff0ac5..3e23773549 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
+@@ -113,6 +113,11 @@ class DesktopCaptureOptions {
}
#endif
@@ -1450,7 +1464,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
private:
#if defined(USE_X11)
rtc::scoped_refptr<SharedXDisplay> x_display_;
-@@ -129,6 +134,9 @@
+@@ -135,6 +140,9 @@ class DesktopCaptureOptions {
#endif
bool disable_effects_ = true;
bool detect_updated_region_ = false;
@@ -1460,10 +1474,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
};
} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc 2019-01-07 13:16:46.389433070 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc 2019-01-07 13:20:40.148768342 +0100
-@@ -66,4 +66,17 @@
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc
+index 2fe6e4a03e..7575fd22bb 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc
+@@ -70,4 +70,17 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateAppCapturer(
return capturer;
}
@@ -1481,10 +1496,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
+#endif
+
} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h 2019-01-07 13:16:46.394433120 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h 2019-01-07 13:20:40.147768332 +0100
-@@ -129,6 +129,10 @@
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h
+index ad61e044c8..cfabf3e864 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h
+@@ -140,6 +140,10 @@ class DesktopCapturer {
static std::unique_ptr<DesktopCapturer> CreateAppCapturer(
const DesktopCaptureOptions& options);
@@ -1495,9 +1511,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desk
protected:
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
// the following two functions are protected.
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc 2019-01-07 13:20:40.165768512 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc
+new file mode 100644
+index 0000000000..c3e608b701
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
@@ -1509,10 +1527,10 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
++#include "modules/desktop_capture/mouse_cursor_monitor.h"
+
+#if defined(USE_X11)
-+#include "webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h"
++#include "modules/desktop_capture/mouse_cursor_monitor_x11.h"
+#endif // defined(USE_X11)
+
+namespace webrtc {
@@ -1539,19 +1557,20 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc 2019-01-07 13:16:46.368432860 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc 2019-01-07 13:20:40.166768522 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
+index 53e808f4ca..e552b5ec4c 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
@@ -16,6 +16,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-+#include "webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h"
++#include "modules/desktop_capture/mouse_cursor_monitor_x11.h"
+
- #include "webrtc/modules/desktop_capture/desktop_capture_options.h"
- #include "webrtc/modules/desktop_capture/desktop_frame.h"
- #include "webrtc/modules/desktop_capture/mouse_cursor.h"
-@@ -59,38 +61,6 @@
+ #include "modules/desktop_capture/desktop_capture_options.h"
+ #include "modules/desktop_capture/desktop_capture_types.h"
+ #include "modules/desktop_capture/desktop_frame.h"
+@@ -60,38 +62,6 @@ Window GetTopLevelWindow(Display* display, Window window) {
namespace webrtc {
@@ -1561,7 +1580,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
- MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window, Window inner_window);
- ~MouseCursorMonitorX11() override;
-
-- void Start(Callback* callback, Mode mode) override;
+- void Init(Callback* callback, Mode mode) override;
- void Stop() override;
- void Capture() override;
-
@@ -1590,7 +1609,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
MouseCursorMonitorX11::MouseCursorMonitorX11(
const DesktopCaptureOptions& options,
Window window, Window inner_window)
-@@ -244,7 +214,7 @@
+@@ -263,7 +233,7 @@ void MouseCursorMonitorX11::CaptureCursor() {
}
// static
@@ -1599,7 +1618,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
const DesktopCaptureOptions& options, WindowId window) {
if (!options.x_display())
return NULL;
-@@ -254,7 +224,7 @@
+@@ -273,7 +243,7 @@ MouseCursorMonitor* MouseCursorMonitor::CreateForWindow(
return new MouseCursorMonitorX11(options, outer_window, window);
}
@@ -1608,9 +1627,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
const DesktopCaptureOptions& options,
ScreenId screen) {
if (!options.x_display())
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h 2019-01-07 13:20:40.164768502 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h
+new file mode 100644
+index 0000000000..1e164be38b
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -1628,12 +1649,12 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
+#include <X11/X.h>
+#include <memory>
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
-+#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
-+#include "webrtc/modules/desktop_capture/mouse_cursor.h"
-+#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
-+#include "webrtc/base/scoped_ref_ptr.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capture_types.h"
++#include "modules/desktop_capture/x11/shared_x_display.h"
++#include "modules/desktop_capture/mouse_cursor.h"
++#include "modules/desktop_capture/mouse_cursor_monitor.h"
++#include "rtc_base/scoped_ref_ptr.h"
+
+namespace webrtc {
+
@@ -1643,7 +1664,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
+ MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window, Window inner_window);
+ ~MouseCursorMonitorX11() override;
+
-+ void Start(Callback* callback, Mode mode) override;
++ void Init(Callback* callback, Mode mode) override;
+ void Stop() override;
+ void Capture() override;
+
@@ -1675,9 +1696,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mous
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_X11_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2019-01-07 13:20:40.170768562 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
+new file mode 100644
+index 0000000000..74de2a43df
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -1689,15 +1712,15 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
+
+#if defined(WEBRTC_USE_PIPEWIRE)
-+#include "webrtc/modules/desktop_capture/screen_capturer_pipewire.h"
++#include "modules/desktop_capture/screen_capturer_pipewire.h"
+#endif // defined(WEBRTC_USE_PIPEWIRE)
+
+#if defined(USE_X11)
-+#include "webrtc/modules/desktop_capture/screen_capturer_x11.h"
++#include "modules/desktop_capture/screen_capturer_x11.h"
+#endif // defined(USE_X11)
+
+namespace webrtc {
@@ -1719,9 +1742,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc 2019-01-07 13:20:40.171768572 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc
+new file mode 100644
+index 0000000000..ac48c2e0d7
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -1733,7 +1758,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/screen_capturer_pipewire.h"
++#include "modules/desktop_capture/screen_capturer_pipewire.h"
+
+#include <memory>
+
@@ -1754,9 +1779,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h 2019-01-07 13:20:40.168768542 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h
+new file mode 100644
+index 0000000000..05200b36b7
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -1773,7 +1800,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+
+#include <memory>
+
-+#include "webrtc/modules/desktop_capture/base_capturer_pipewire.h"
++#include "modules/desktop_capture/base_capturer_pipewire.h"
+
+namespace webrtc {
+
@@ -1791,20 +1818,21 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_PIPEWIRE_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc 2019-01-07 13:16:46.376432940 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc 2019-01-07 13:20:40.173768592 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
+index 38810317b1..4379101695 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
@@ -19,6 +19,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-+#include "webrtc/modules/desktop_capture/screen_capturer_x11.h"
++#include "modules/desktop_capture/screen_capturer_x11.h"
+
- #include "webrtc/base/checks.h"
- #include "webrtc/base/constructormagic.h"
- #include "webrtc/base/timeutils.h"
+ #include "modules/desktop_capture/desktop_capture_options.h"
+ #include "modules/desktop_capture/desktop_capturer.h"
+ #include "modules/desktop_capture/desktop_frame.h"
@@ -32,100 +34,12 @@
- #include "webrtc/system_wrappers/include/logging.h"
+ #include "rtc_base/timeutils.h"
namespace webrtc {
-namespace {
@@ -1895,8 +1923,9 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
-
- RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerLinux);
-};
-
+-
-ScreenCapturerLinux::ScreenCapturerLinux() {
++
+ScreenCapturerX11::ScreenCapturerX11() {
helper_.SetLogGridSize(4);
}
@@ -1906,7 +1935,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
options_.x_display()->RemoveEventHandler(ConfigureNotify, this);
if (use_damage_) {
options_.x_display()->RemoveEventHandler(
-@@ -134,7 +48,7 @@
+@@ -134,7 +48,7 @@ ScreenCapturerLinux::~ScreenCapturerLinux() {
DeinitXlib();
}
@@ -1915,7 +1944,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
options_ = options;
root_window_ = RootWindow(display(), DefaultScreen(display()));
-@@ -177,7 +91,7 @@
+@@ -177,7 +91,7 @@ bool ScreenCapturerLinux::Init(const DesktopCaptureOptions& options) {
return true;
}
@@ -1924,8 +1953,8 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
// Our use of XDamage requires XFixes.
if (!has_xfixes_) {
return;
-@@ -218,18 +132,18 @@
- LOG(LS_INFO) << "Using XDamage extension.";
+@@ -218,18 +132,18 @@ void ScreenCapturerLinux::InitXDamage() {
+ RTC_LOG(LS_INFO) << "Using XDamage extension.";
}
-void ScreenCapturerLinux::Start(Callback* callback) {
@@ -1946,23 +1975,23 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
int64_t capture_start_time_nanos = rtc::TimeNanos();
queue_.MoveToNextFrame();
-@@ -243,6 +157,7 @@
+@@ -243,6 +157,7 @@ void ScreenCapturerLinux::CaptureFrame() {
// in a good shape.
if (!x_server_pixel_buffer_.is_initialized()) {
// We failed to initialize pixel buffer.
-+ LOG(LS_ERROR) << "Pixel buffer is not initialized.";
++ RTC_LOG(LS_ERROR) << "Pixel buffer is not initialized.";
callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr);
return;
}
-@@ -258,6 +173,7 @@
+@@ -258,6 +173,7 @@ void ScreenCapturerLinux::CaptureFrame() {
std::unique_ptr<DesktopFrame> result = CaptureScreen();
if (!result) {
-+ LOG(LS_WARNING) << "Temporarily failed to capture screen.";
++ RTC_LOG(LS_WARNING) << "Temporarily failed to capture screen.";
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
return;
}
-@@ -268,19 +184,19 @@
+@@ -268,19 +184,19 @@ void ScreenCapturerLinux::CaptureFrame() {
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
}
@@ -1985,7 +2014,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) {
const XDamageNotifyEvent* damage_event =
reinterpret_cast<const XDamageNotifyEvent*>(&event);
-@@ -295,7 +211,7 @@
+@@ -295,7 +211,7 @@ bool ScreenCapturerLinux::HandleXEvent(const XEvent& event) {
return false;
}
@@ -1994,16 +2023,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
RTC_DCHECK(x_server_pixel_buffer_.window_size().equals(frame->size()));
-@@ -345,14 +261,15 @@
- // Doing full-screen polling, or this is the first capture after a
- // screen-resolution change. In either case, need a full-screen capture.
- DesktopRect screen_rect = DesktopRect::MakeSize(frame->size());
-- x_server_pixel_buffer_.CaptureRect(screen_rect, frame.get());
-+ if (!x_server_pixel_buffer_.CaptureRect(screen_rect, frame.get()))
-+ return nullptr;
- updated_region->SetRect(screen_rect);
- }
-
+@@ -353,7 +269,7 @@ std::unique_ptr<DesktopFrame> ScreenCapturerLinux::CaptureScreen() {
return std::move(frame);
}
@@ -2012,7 +2032,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
// Make sure the frame buffers will be reallocated.
queue_.Reset();
-@@ -363,7 +280,7 @@
+@@ -364,7 +280,7 @@ void ScreenCapturerLinux::ScreenConfigurationChanged() {
}
}
@@ -2021,7 +2041,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
// Synchronize the current buffer with the previous one since we do not
// capture the entire desktop. Note that encoder may be reading from the
// previous buffer at this time so thread access complaints are false
-@@ -383,7 +300,7 @@
+@@ -384,7 +300,7 @@ void ScreenCapturerLinux::SynchronizeFrame() {
}
}
@@ -2030,7 +2050,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
if (gc_) {
XFreeGC(display(), gc_);
gc_ = nullptr;
-@@ -404,20 +321,18 @@
+@@ -405,15 +321,13 @@ void ScreenCapturerLinux::DeinitXlib() {
}
}
@@ -2048,15 +2068,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
if (!capturer.get()->Init(options)) {
return nullptr;
}
-
-- return std::unique_ptr<DesktopCapturer>(capturer.release());
-+ return std::move(capturer);
- }
-
- } // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h 2019-01-07 13:20:40.169768552 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h
+new file mode 100644
+index 0000000000..6b0620236c
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -2077,16 +2093,16 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+#include <X11/extensions/Xfixes.h>
+#include <memory>
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
-+#include "webrtc/modules/desktop_capture/desktop_frame.h"
-+#include "webrtc/modules/desktop_capture/desktop_region.h"
-+#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
-+#include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
-+#include "webrtc/modules/desktop_capture/screen_capture_frame_queue.h"
-+#include "webrtc/modules/desktop_capture/screen_capturer_helper.h"
-+#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
-+#include "webrtc/base/constructormagic.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_frame.h"
++#include "modules/desktop_capture/desktop_region.h"
++#include "modules/desktop_capture/x11/shared_x_display.h"
++#include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
++#include "modules/desktop_capture/screen_capture_frame_queue.h"
++#include "modules/desktop_capture/screen_capturer_helper.h"
++#include "modules/desktop_capture/shared_desktop_frame.h"
++#include "rtc_base/constructormagic.h"
+
+namespace webrtc {
+
@@ -2182,9 +2198,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/scre
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_X11_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2019-01-07 13:20:40.196768822 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
+new file mode 100644
+index 0000000000..befabb9438
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -2196,15 +2214,15 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
+
+#if defined(WEBRTC_USE_PIPEWIRE)
-+#include "webrtc/modules/desktop_capture/window_capturer_pipewire.h"
++#include "modules/desktop_capture/window_capturer_pipewire.h"
+#endif // defined(WEBRTC_USE_PIPEWIRE)
+
+#if defined(USE_X11)
-+#include "webrtc/modules/desktop_capture/window_capturer_x11.h"
++#include "modules/desktop_capture/window_capturer_x11.h"
+#endif // defined(USE_X11)
+
+namespace webrtc {
@@ -2226,9 +2244,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+}
+
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc 2019-01-07 13:20:40.197768832 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc
+new file mode 100644
+index 0000000000..e80eaa7598
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -2240,7 +2260,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
-+#include "webrtc/modules/desktop_capture/window_capturer_pipewire.h"
++#include "modules/desktop_capture/window_capturer_pipewire.h"
+
+namespace webrtc {
+
@@ -2258,9 +2278,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+ return std::move(capturer);
+}
+} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h 2019-01-07 13:20:40.177768632 +0100
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h
+new file mode 100644
+index 0000000000..a3fea6cb82
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@@ -2277,7 +2299,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+
+#include <memory>
+
-+#include "webrtc/modules/desktop_capture/base_capturer_pipewire.h"
++#include "modules/desktop_capture/base_capturer_pipewire.h"
+
+namespace webrtc {
+
@@ -2295,19 +2317,20 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_PIPEWIRE_H_
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc 2019-01-07 13:16:46.375432930 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc 2019-01-07 13:20:40.198768842 +0100
-@@ -17,6 +17,8 @@
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
+index a97698dcbd..f3fb28d808 100644
+--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
+@@ -16,6 +16,8 @@
- #include <algorithm>
+ #include <utility>
-+#include "webrtc/modules/desktop_capture/window_capturer_x11.h"
++#include "modules/desktop_capture/window_capturer_x11.h"
+
- #include "webrtc/base/constructormagic.h"
- #include "webrtc/base/scoped_ref_ptr.h"
- #include "webrtc/modules/desktop_capture/desktop_capturer.h"
-@@ -30,58 +32,7 @@
+ #include "modules/desktop_capture/desktop_capture_options.h"
+ #include "modules/desktop_capture/desktop_capturer.h"
+ #include "modules/desktop_capture/desktop_frame.h"
+@@ -32,50 +34,7 @@
namespace webrtc {
@@ -2326,6 +2349,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
- bool GetSourceList(SourceList* sources) override;
- bool SelectSource(SourceId id) override;
- bool FocusOnSelectedSource() override;
+- bool IsOccluded(const DesktopVector& pos) override;
-
- // SharedXDisplay::XEventHandler interface.
- bool HandleXEvent(const XEvent& event) override;
@@ -2333,14 +2357,6 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
- private:
- Display* display() { return x_display_->display(); }
-
-- // Iterates through |window| hierarchy to find first visible window, i.e. one
-- // that has WM_STATE property set to NormalState.
-- // See http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1 .
-- ::Window GetApplicationWindow(::Window window);
--
-- // Returns true if the |window| is a desktop element.
-- bool IsDesktopElement(::Window window);
--
- // Returns window title for the specified X |window|.
- bool GetWindowTitle(::Window window, std::string* title);
-
@@ -2351,23 +2367,22 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
-
- rtc::scoped_refptr<SharedXDisplay> x_display_;
-
-- Atom wm_state_atom_;
-- Atom window_type_atom_;
-- Atom normal_window_type_atom_;
- bool has_composite_extension_ = false;
-
- ::Window selected_window_ = 0;
- XServerPixelBuffer x_server_pixel_buffer_;
+- XAtomCache atom_cache_;
+- WindowFinderX11 window_finder_;
-
- RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerLinux);
-};
-
-WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options)
+WindowCapturerX11::WindowCapturerX11(const DesktopCaptureOptions& options)
- : x_display_(options.x_display()) {
- // Create Atoms so we don't need to do it every time they are used.
- wm_state_atom_ = XInternAtom(display(), "WM_STATE", True);
-@@ -102,11 +53,11 @@
+ : x_display_(options.x_display()),
+ atom_cache_(display()),
+ window_finder_(&atom_cache_) {
+@@ -92,11 +51,11 @@ WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options)
x_display_->AddEventHandler(ConfigureNotify, this);
}
@@ -2378,11 +2393,11 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
-bool WindowCapturerLinux::GetSourceList(SourceList* sources) {
+bool WindowCapturerX11::GetSourceList(SourceList* sources) {
- SourceList result;
-
- XErrorTrap error_trap(display());
-@@ -159,7 +110,7 @@
- return true;
+ return GetWindowList(&atom_cache_,
+ [this, sources](::Window window) {
+ Source w;
+@@ -109,7 +68,7 @@ bool WindowCapturerLinux::GetSourceList(SourceList* sources) {
+ });
}
-bool WindowCapturerLinux::SelectSource(SourceId id) {
@@ -2390,7 +2405,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
if (!x_server_pixel_buffer_.Init(display(), id))
return false;
-@@ -180,7 +131,7 @@
+@@ -130,7 +89,7 @@ bool WindowCapturerLinux::SelectSource(SourceId id) {
return true;
}
@@ -2399,14 +2414,14 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
if (!selected_window_)
return false;
-@@ -229,18 +180,18 @@
+@@ -179,18 +138,18 @@ bool WindowCapturerLinux::FocusOnSelectedSource() {
return true;
}
-void WindowCapturerLinux::Start(Callback* callback) {
+void WindowCapturerX11::Start(Callback* callback) {
- assert(!callback_);
- assert(callback);
+ RTC_DCHECK(!callback_);
+ RTC_DCHECK(callback);
callback_ = callback;
}
@@ -2421,43 +2436,31 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
x_display_->ProcessPendingXEvents();
if (!x_server_pixel_buffer_.IsWindowValid()) {
-@@ -274,7 +225,7 @@
+@@ -233,12 +192,12 @@ void WindowCapturerLinux::CaptureFrame() {
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
}
+-bool WindowCapturerLinux::IsOccluded(const DesktopVector& pos) {
++bool WindowCapturerX11::IsOccluded(const DesktopVector& pos) {
+ return window_finder_.GetWindowUnderPoint(pos) !=
+ static_cast<WindowId>(selected_window_);
+ }
+
-bool WindowCapturerLinux::HandleXEvent(const XEvent& event) {
+bool WindowCapturerX11::HandleXEvent(const XEvent& event) {
if (event.type == ConfigureNotify) {
XConfigureEvent xce = event.xconfigure;
- if (!DesktopSize(xce.width, xce.height).equals(
-@@ -288,7 +239,7 @@
+ if (xce.window == selected_window_) {
+@@ -256,7 +215,7 @@ bool WindowCapturerLinux::HandleXEvent(const XEvent& event) {
return false;
}
--::Window WindowCapturerLinux::GetApplicationWindow(::Window window) {
-+::Window WindowCapturerX11::GetApplicationWindow(::Window window) {
- // Get WM_STATE property of the window.
- XWindowProperty<uint32_t> window_state(display(), window, wm_state_atom_);
-
-@@ -326,7 +277,7 @@
- return app_window;
- }
-
--bool WindowCapturerLinux::IsDesktopElement(::Window window) {
-+bool WindowCapturerX11::IsDesktopElement(::Window window) {
- if (window == 0)
- return false;
-
-@@ -361,7 +312,7 @@
- return result;
- }
-
-bool WindowCapturerLinux::GetWindowTitle(::Window window, std::string* title) {
+bool WindowCapturerX11::GetWindowTitle(::Window window, std::string* title) {
int status;
bool result = false;
XTextProperty window_name;
-@@ -390,9 +341,7 @@
+@@ -285,9 +244,7 @@ bool WindowCapturerLinux::GetWindowTitle(::Window window, std::string* title) {
return result;
}
@@ -2468,7 +2471,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
// Get _NET_WM_PID property of the window.
Atom process_atom = XInternAtom(display(), "_NET_WM_PID", True);
XWindowProperty<uint32_t> process_id(display(), window, process_atom);
-@@ -401,11 +350,11 @@
+@@ -296,11 +253,11 @@ int WindowCapturerLinux::GetWindowProcessID(::Window window) {
}
// static
@@ -2482,10 +2485,12 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
}
} // namespace webrtc
-diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h
---- firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h 1970-01-01 01:00:00.000000000 +0100
-+++ firefox-webrtc/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h 2019-01-07 13:20:40.177768632 +0100
-@@ -0,0 +1,83 @@
+diff --git a/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h
+new file mode 100644
+index 0000000000..369c59813e
+--- /dev/null
++++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h
+@@ -0,0 +1,77 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@@ -2504,13 +2509,15 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+#include <memory>
+#include <string>
+
-+#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
-+#include "webrtc/modules/desktop_capture/desktop_capturer.h"
-+#include "webrtc/modules/desktop_capture/desktop_geometry.h"
-+#include "webrtc/modules/desktop_capture/x11/shared_x_display.h"
-+#include "webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.h"
-+#include "webrtc/base/constructormagic.h"
-+#include "webrtc/base/scoped_ref_ptr.h"
++#include "modules/desktop_capture/desktop_capture_options.h"
++#include "modules/desktop_capture/desktop_capturer.h"
++#include "modules/desktop_capture/desktop_geometry.h"
++#include "modules/desktop_capture/window_finder_x11.h"
++#include "modules/desktop_capture/x11/x_atom_cache.h"
++#include "modules/desktop_capture/x11/shared_x_display.h"
++#include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
++#include "rtc_base/constructormagic.h"
++#include "rtc_base/scoped_ref_ptr.h"
+
+namespace webrtc {
+
@@ -2530,6 +2537,7 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+ bool GetSourceList(SourceList* sources) override;
+ bool SelectSource(SourceId id) override;
+ bool FocusOnSelectedSource() override;
++ bool IsOccluded(const DesktopVector& pos) override;
+
+ // SharedXDisplay::XEventHandler interface.
+ bool HandleXEvent(const XEvent& event) override;
@@ -2537,14 +2545,6 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+ private:
+ Display* display() { return x_display_->display(); }
+
-+ // Iterates through |window| hierarchy to find first visible window, i.e. one
-+ // that has WM_STATE property set to NormalState.
-+ // See http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1 .
-+ ::Window GetApplicationWindow(::Window window);
-+
-+ // Returns true if the |window| is a desktop element.
-+ bool IsDesktopElement(::Window window);
-+
+ // Returns window title for the specified X |window|.
+ bool GetWindowTitle(::Window window, std::string* title);
+
@@ -2555,13 +2555,12 @@ diff -ENwbur firefox-64.0/media/webrtc/trunk/webrtc/modules/desktop_capture/wind
+
+ rtc::scoped_refptr<SharedXDisplay> x_display_;
+
-+ Atom wm_state_atom_;
-+ Atom window_type_atom_;
-+ Atom normal_window_type_atom_;
+ bool has_composite_extension_ = false;
+
+ ::Window selected_window_ = 0;
+ XServerPixelBuffer x_server_pixel_buffer_;
++ XAtomCache atom_cache_;
++ WindowFinderX11 window_finder_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerX11);
+};
bgstack15