Rebase and apply the PipeWire patch

This commit is contained in:
Tomas Popela 2019-03-13 09:21:33 +01:00
parent bc42e3d624
commit 69d7077952
2 changed files with 112 additions and 174 deletions

View File

@ -1,7 +1,6 @@
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
diff -up firefox-66.0/config/system-headers.mozbuild.firefox-pipewire firefox-66.0/config/system-headers.mozbuild
--- firefox-66.0/config/system-headers.mozbuild.firefox-pipewire 2019-03-12 01:22:15.000000000 +0100
+++ firefox-66.0/config/system-headers.mozbuild 2019-03-12 15:27:37.675285710 +0100
@@ -314,6 +314,7 @@ system_headers = [
'Gestalt.h',
'getopt.h',
@ -18,11 +17,9 @@ index b257e6f8e3..aa58a7fe58 100644
'pixman.h',
'pk11func.h',
'pk11pqg.h',
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.675285710 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc 2019-03-12 15:27:37.675285710 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
@ -63,10 +60,9 @@ index 0000000000..508b695540
+}
+
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc 2019-03-12 15:27:37.675285710 +0100
@@ -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.
@ -77,7 +73,7 @@ index 5cbd143556..95d816f973 100755
#include <assert.h>
#include <string.h>
@@ -21,80 +18,18 @@
@@ -21,79 +18,18 @@
#include <algorithm>
@ -127,7 +123,6 @@ index 5cbd143556..95d816f973 100755
-
- // DesktopCapturer interface.
- virtual void Start(Callback* callback) override;
- virtual void Stop() override;
- virtual void CaptureFrame() override;
- virtual bool SelectSource(SourceId id) override
- {
@ -161,7 +156,7 @@ index 5cbd143556..95d816f973 100755
: callback_(NULL),
selected_process_(0),
x_display_(options.x_display()) {
@@ -103,7 +38,7 @@ AppCapturerLinux::AppCapturerLinux(const DesktopCaptureOptions& options)
@@ -102,7 +38,7 @@ AppCapturerLinux::AppCapturerLinux(const
rgn_background_ = XCreateRegion();
}
@ -170,7 +165,7 @@ index 5cbd143556..95d816f973 100755
if (rgn_mask_) {
XDestroyRegion(rgn_mask_);
}
@@ -116,32 +51,32 @@ AppCapturerLinux::~AppCapturerLinux() {
@@ -115,28 +51,28 @@ AppCapturerLinux::~AppCapturerLinux() {
}
// AppCapturer interface.
@ -199,17 +194,12 @@ index 5cbd143556..95d816f973 100755
callback_ = callback;
}
-void AppCapturerLinux::Stop() {
+void AppCapturerX11::Stop() {
callback_ = NULL;
}
-void AppCapturerLinux::CaptureFrame() {
+void AppCapturerX11::CaptureFrame() {
XErrorTrap error_trap(GetDisplay());
//Capture screen >> set root window as capture window
@@ -169,7 +104,7 @@ void AppCapturerLinux::CaptureFrame() {
@@ -164,7 +100,7 @@ void AppCapturerLinux::CaptureFrame() {
}
}
@ -218,7 +208,7 @@ index 5cbd143556..95d816f973 100755
XErrorTrap error_trap(GetDisplay());
if (!pDesktopFrame) {
@@ -192,7 +127,7 @@ void AppCapturerLinux::FillDesktopFrameRegionWithColor(DesktopFrame* pDesktopFra
@@ -187,7 +123,7 @@ void AppCapturerLinux::FillDesktopFrameR
}
}
@ -227,7 +217,7 @@ index 5cbd143556..95d816f973 100755
XErrorTrap error_trap(GetDisplay());
XSubtractRegion(rgn_visual_, rgn_visual_, rgn_visual_);
@@ -269,21 +204,19 @@ bool AppCapturerLinux::UpdateRegions() {
@@ -264,21 +200,19 @@ bool AppCapturerLinux::UpdateRegions() {
return true;
}
@ -253,12 +243,10 @@ index 5cbd143556..95d816f973 100755
return std::unique_ptr<DesktopCapturer>(std::move(capturer));
}
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 @@
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.h 2019-03-12 16:08:04.440031789 +0100
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@ -325,7 +313,6 @@ index 0000000000..2b3d0dc0ad
+
+ // DesktopCapturer interface.
+ virtual void Start(Callback* callback) override;
+ virtual void Stop() override;
+ virtual void CaptureFrame() override;
+ virtual bool SelectSource(SourceId id) override
+ {
@ -357,11 +344,9 @@ index 0000000000..2b3d0dc0ad
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_APP_CAPTURER_X11_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.cc 2019-03-12 15:27:37.676285720 +0100
@@ -0,0 +1,849 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -1212,12 +1197,10 @@ index 0000000000..47350149f4
+}
+
+} // namespace webrtc
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 @@
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.676285720 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/base_capturer_pipewire.h 2019-03-12 16:08:26.294298896 +0100
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@ -1258,7 +1241,6 @@ index 0000000000..3841938bd7
+
+ // DesktopCapturer interface.
+ void Start(Callback* delegate) override;
+ void Stop() override { callback_ = nullptr; }
+ void CaptureFrame() override;
+ bool GetSourceList(SourceList* sources) override;
+ bool SelectSource(SourceId id) override;
@ -1385,10 +1367,9 @@ index 0000000000..3841938bd7
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_BASE_CAPTURER_PIPEWIRE_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_generic_gn/moz.build 2019-03-12 15:27:37.676285720 +0100
@@ -152,10 +152,10 @@ if CONFIG["OS_TARGET"] == "FreeBSD":
"/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
]
@ -1401,11 +1382,10 @@ index e8421fc3d3..6be802e0b4 100644
DEFINES["WEBRTC_LINUX"] = True
DEFINES["WEBRTC_POSIX"] = True
DEFINES["_FILE_OFFSET_BITS"] = "64"
@@ -174,6 +174,18 @@ if CONFIG["OS_TARGET"] == "Linux":
"Xrender"
@@ -175,6 +175,18 @@ if CONFIG["OS_TARGET"] == "Linux":
]
+ UNIFIED_SOURCES += [
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",
+ "/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc",
@ -1417,9 +1397,10 @@ index e8421fc3d3..6be802e0b4 100644
+
+ DEFINES["USE_X11"] = "1"
+
UNIFIED_SOURCES += [
+ 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",
"/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc",
@@ -189,6 +201,27 @@ if CONFIG["OS_TARGET"] == "Linux":
"/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/x_server_pixel_buffer.cc"
]
@ -1448,10 +1429,9 @@ index e8421fc3d3..6be802e0b4 100644
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capture_options.h 2019-03-12 15:27:37.677285729 +0100
@@ -113,6 +113,11 @@ class DesktopCaptureOptions {
}
#endif
@ -1474,11 +1454,10 @@ index fec5ff0ac5..3e23773549 100644
};
} // namespace webrtc
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(
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.cc 2019-03-12 15:27:37.677285729 +0100
@@ -70,4 +70,17 @@ std::unique_ptr<DesktopCapturer> Desktop
return capturer;
}
@ -1496,11 +1475,10 @@ index 2fe6e4a03e..7575fd22bb 100644
+#endif
+
} // namespace webrtc
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 {
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h.firefox-pipewire 2019-03-12 01:22:20.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/desktop_capturer.h 2019-03-12 15:27:37.677285729 +0100
@@ -139,6 +139,10 @@ class DesktopCapturer {
static std::unique_ptr<DesktopCapturer> CreateAppCapturer(
const DesktopCaptureOptions& options);
@ -1511,11 +1489,9 @@ index ad61e044c8..cfabf3e864 100644
protected:
// CroppingWindowCapturer needs to create raw capturers without wrappers, so
// the following two functions are protected.
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc.firefox-pipewire 2019-03-12 15:27:37.677285729 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_linux.cc 2019-03-12 15:27:37.677285729 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
@ -1557,10 +1533,9 @@ index 0000000000..c3e608b701
+}
+
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.cc 2019-03-12 15:27:37.678285739 +0100
@@ -16,6 +16,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -1570,7 +1545,7 @@ index 53e808f4ca..e552b5ec4c 100644
#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) {
@@ -60,37 +62,6 @@ Window GetTopLevelWindow(Display* displa
namespace webrtc {
@ -1581,7 +1556,6 @@ index 53e808f4ca..e552b5ec4c 100644
- ~MouseCursorMonitorX11() override;
-
- void Init(Callback* callback, Mode mode) override;
- void Stop() override;
- void Capture() override;
-
- private:
@ -1609,7 +1583,7 @@ index 53e808f4ca..e552b5ec4c 100644
MouseCursorMonitorX11::MouseCursorMonitorX11(
const DesktopCaptureOptions& options,
Window window, Window inner_window)
@@ -263,7 +233,7 @@ void MouseCursorMonitorX11::CaptureCursor() {
@@ -257,7 +228,7 @@ void MouseCursorMonitorX11::CaptureCurso
}
// static
@ -1618,7 +1592,7 @@ index 53e808f4ca..e552b5ec4c 100644
const DesktopCaptureOptions& options, WindowId window) {
if (!options.x_display())
return NULL;
@@ -273,7 +243,7 @@ MouseCursorMonitor* MouseCursorMonitor::CreateForWindow(
@@ -267,7 +238,7 @@ MouseCursorMonitor* MouseCursorMonitor::
return new MouseCursorMonitorX11(options, outer_window, window);
}
@ -1627,12 +1601,10 @@ index 53e808f4ca..e552b5ec4c 100644
const DesktopCaptureOptions& options,
ScreenId screen) {
if (!options.x_display())
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 @@
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/mouse_cursor_monitor_x11.h 2019-03-13 08:06:28.525517995 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@ -1665,7 +1637,6 @@ index 0000000000..1e164be38b
+ ~MouseCursorMonitorX11() override;
+
+ void Init(Callback* callback, Mode mode) override;
+ void Stop() override;
+ void Capture() override;
+
+ static MouseCursorMonitor* CreateForWindow(const DesktopCaptureOptions& options, WindowId window);
@ -1696,11 +1667,9 @@ index 0000000000..1e164be38b
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_X11_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_linux.cc 2019-03-12 15:27:37.678285739 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -1742,11 +1711,9 @@ index 0000000000..74de2a43df
+}
+
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.678285739 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.cc 2019-03-12 15:27:37.678285739 +0100
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -1779,11 +1746,9 @@ index 0000000000..ac48c2e0d7
+}
+
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_pipewire.h 2019-03-12 15:27:37.679285748 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -1818,10 +1783,9 @@ index 0000000000..05200b36b7
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_PIPEWIRE_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.cc 2019-03-12 15:27:37.679285748 +0100
@@ -19,6 +19,8 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@ -1831,7 +1795,7 @@ index 38810317b1..4379101695 100644
#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 @@
@@ -32,99 +34,12 @@
#include "rtc_base/timeutils.h"
namespace webrtc {
@ -1855,7 +1819,6 @@ index 38810317b1..4379101695 100644
-
- // DesktopCapturer interface.
- void Start(Callback* delegate) override;
- void Stop() override;
- void CaptureFrame() override;
- bool GetSourceList(SourceList* sources) override;
- bool SelectSource(SourceId id) override;
@ -1920,12 +1883,11 @@ index 38810317b1..4379101695 100644
- // Invalid region from the previous capture. This is used to synchronize the
- // current with the last buffer used.
- DesktopRegion last_invalid_region_;
-
- RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerLinux);
-};
-
-ScreenCapturerLinux::ScreenCapturerLinux() {
+
+ScreenCapturerX11::ScreenCapturerX11() {
helper_.SetLogGridSize(4);
}
@ -1935,7 +1897,7 @@ index 38810317b1..4379101695 100644
options_.x_display()->RemoveEventHandler(ConfigureNotify, this);
if (use_damage_) {
options_.x_display()->RemoveEventHandler(
@@ -134,7 +48,7 @@ ScreenCapturerLinux::~ScreenCapturerLinux() {
@@ -133,7 +48,7 @@ ScreenCapturerLinux::~ScreenCapturerLinu
DeinitXlib();
}
@ -1944,7 +1906,7 @@ index 38810317b1..4379101695 100644
options_ = options;
root_window_ = RootWindow(display(), DefaultScreen(display()));
@@ -177,7 +91,7 @@ bool ScreenCapturerLinux::Init(const DesktopCaptureOptions& options) {
@@ -176,7 +91,7 @@ bool ScreenCapturerLinux::Init(const Des
return true;
}
@ -1953,7 +1915,7 @@ index 38810317b1..4379101695 100644
// Our use of XDamage requires XFixes.
if (!has_xfixes_) {
return;
@@ -218,18 +132,18 @@ void ScreenCapturerLinux::InitXDamage() {
@@ -217,14 +132,14 @@ void ScreenCapturerLinux::InitXDamage()
RTC_LOG(LS_INFO) << "Using XDamage extension.";
}
@ -1965,17 +1927,12 @@ index 38810317b1..4379101695 100644
callback_ = callback;
}
-void ScreenCapturerLinux::Stop() {
+void ScreenCapturerX11::Stop() {
callback_ = NULL;
}
-void ScreenCapturerLinux::CaptureFrame() {
+void ScreenCapturerX11::CaptureFrame() {
int64_t capture_start_time_nanos = rtc::TimeNanos();
queue_.MoveToNextFrame();
@@ -243,6 +157,7 @@ void ScreenCapturerLinux::CaptureFrame() {
@@ -238,6 +153,7 @@ void ScreenCapturerLinux::CaptureFrame()
// in a good shape.
if (!x_server_pixel_buffer_.is_initialized()) {
// We failed to initialize pixel buffer.
@ -1983,7 +1940,7 @@ index 38810317b1..4379101695 100644
callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr);
return;
}
@@ -258,6 +173,7 @@ void ScreenCapturerLinux::CaptureFrame() {
@@ -253,6 +169,7 @@ void ScreenCapturerLinux::CaptureFrame()
std::unique_ptr<DesktopFrame> result = CaptureScreen();
if (!result) {
@ -1991,7 +1948,7 @@ index 38810317b1..4379101695 100644
callback_->OnCaptureResult(Result::ERROR_TEMPORARY, nullptr);
return;
}
@@ -268,19 +184,19 @@ void ScreenCapturerLinux::CaptureFrame() {
@@ -263,19 +180,19 @@ void ScreenCapturerLinux::CaptureFrame()
callback_->OnCaptureResult(Result::SUCCESS, std::move(result));
}
@ -2014,7 +1971,7 @@ index 38810317b1..4379101695 100644
if (use_damage_ && (event.type == damage_event_base_ + XDamageNotify)) {
const XDamageNotifyEvent* damage_event =
reinterpret_cast<const XDamageNotifyEvent*>(&event);
@@ -295,7 +211,7 @@ bool ScreenCapturerLinux::HandleXEvent(const XEvent& event) {
@@ -290,7 +207,7 @@ bool ScreenCapturerLinux::HandleXEvent(c
return false;
}
@ -2023,7 +1980,7 @@ index 38810317b1..4379101695 100644
std::unique_ptr<SharedDesktopFrame> frame = queue_.current_frame()->Share();
RTC_DCHECK(x_server_pixel_buffer_.window_size().equals(frame->size()));
@@ -353,7 +269,7 @@ std::unique_ptr<DesktopFrame> ScreenCapturerLinux::CaptureScreen() {
@@ -348,7 +265,7 @@ std::unique_ptr<DesktopFrame> ScreenCapt
return std::move(frame);
}
@ -2032,7 +1989,7 @@ index 38810317b1..4379101695 100644
// Make sure the frame buffers will be reallocated.
queue_.Reset();
@@ -364,7 +280,7 @@ void ScreenCapturerLinux::ScreenConfigurationChanged() {
@@ -359,7 +276,7 @@ void ScreenCapturerLinux::ScreenConfigur
}
}
@ -2041,7 +1998,7 @@ index 38810317b1..4379101695 100644
// 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
@@ -384,7 +300,7 @@ void ScreenCapturerLinux::SynchronizeFrame() {
@@ -379,7 +296,7 @@ void ScreenCapturerLinux::SynchronizeFra
}
}
@ -2050,7 +2007,7 @@ index 38810317b1..4379101695 100644
if (gc_) {
XFreeGC(display(), gc_);
gc_ = nullptr;
@@ -405,15 +321,13 @@ void ScreenCapturerLinux::DeinitXlib() {
@@ -400,15 +317,13 @@ void ScreenCapturerLinux::DeinitXlib() {
}
}
@ -2068,12 +2025,10 @@ index 38810317b1..4379101695 100644
if (!capturer.get()->Init(options)) {
return nullptr;
}
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 @@
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/screen_capturer_x11.h 2019-03-13 08:06:40.412607602 +0100
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@ -2126,7 +2081,6 @@ index 0000000000..6b0620236c
+
+ // DesktopCapturer interface.
+ void Start(Callback* delegate) override;
+ void Stop() override;
+ void CaptureFrame() override;
+ bool GetSourceList(SourceList* sources) override;
+ bool SelectSource(SourceId id) override;
@ -2198,11 +2152,9 @@ index 0000000000..6b0620236c
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_X11_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc.firefox-pipewire 2019-03-12 15:27:37.679285748 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_linux.cc 2019-03-12 15:27:37.679285748 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -2244,11 +2196,9 @@ index 0000000000..befabb9438
+}
+
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.cc 2019-03-12 15:27:37.680285758 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -2278,11 +2228,9 @@ index 0000000000..e80eaa7598
+ return std::move(capturer);
+}
+} // namespace webrtc
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_pipewire.h 2019-03-12 15:27:37.680285758 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
@ -2317,10 +2265,9 @@ index 0000000000..a3fea6cb82
+} // namespace webrtc
+
+#endif // MODULES_DESKTOP_CAPTURE_WINDOW_CAPTURER_PIPEWIRE_H_
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
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc.firefox-pipewire 2019-03-12 01:22:21.000000000 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.cc 2019-03-12 15:27:37.680285758 +0100
@@ -16,6 +16,8 @@
#include <utility>
@ -2330,7 +2277,7 @@ index a97698dcbd..f3fb28d808 100644
#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 @@
@@ -32,49 +34,7 @@
namespace webrtc {
@ -2344,7 +2291,6 @@ index a97698dcbd..f3fb28d808 100644
-
- // DesktopCapturer interface.
- void Start(Callback* callback) override;
- void Stop() override;
- void CaptureFrame() override;
- bool GetSourceList(SourceList* sources) override;
- bool SelectSource(SourceId id) override;
@ -2382,7 +2328,7 @@ index a97698dcbd..f3fb28d808 100644
: x_display_(options.x_display()),
atom_cache_(display()),
window_finder_(&atom_cache_) {
@@ -92,11 +51,11 @@ WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options)
@@ -91,11 +51,11 @@ WindowCapturerLinux::WindowCapturerLinux
x_display_->AddEventHandler(ConfigureNotify, this);
}
@ -2396,7 +2342,7 @@ index a97698dcbd..f3fb28d808 100644
return GetWindowList(&atom_cache_,
[this, sources](::Window window) {
Source w;
@@ -109,7 +68,7 @@ bool WindowCapturerLinux::GetSourceList(SourceList* sources) {
@@ -108,7 +68,7 @@ bool WindowCapturerLinux::GetSourceList(
});
}
@ -2405,7 +2351,7 @@ index a97698dcbd..f3fb28d808 100644
if (!x_server_pixel_buffer_.Init(display(), id))
return false;
@@ -130,7 +89,7 @@ bool WindowCapturerLinux::SelectSource(SourceId id) {
@@ -129,7 +89,7 @@ bool WindowCapturerLinux::SelectSource(S
return true;
}
@ -2414,7 +2360,7 @@ index a97698dcbd..f3fb28d808 100644
if (!selected_window_)
return false;
@@ -179,18 +138,18 @@ bool WindowCapturerLinux::FocusOnSelectedSource() {
@@ -178,14 +138,14 @@ bool WindowCapturerLinux::FocusOnSelecte
return true;
}
@ -2426,17 +2372,12 @@ index a97698dcbd..f3fb28d808 100644
callback_ = callback;
}
-void WindowCapturerLinux::Stop() {
+void WindowCapturerX11::Stop() {
callback_ = NULL;
}
-void WindowCapturerLinux::CaptureFrame() {
+void WindowCapturerX11::CaptureFrame() {
x_display_->ProcessPendingXEvents();
if (!x_server_pixel_buffer_.IsWindowValid()) {
@@ -233,12 +192,12 @@ void WindowCapturerLinux::CaptureFrame() {
@@ -228,12 +188,12 @@ void WindowCapturerLinux::CaptureFrame()
callback_->OnCaptureResult(Result::SUCCESS, std::move(frame));
}
@ -2451,7 +2392,7 @@ index a97698dcbd..f3fb28d808 100644
if (event.type == ConfigureNotify) {
XConfigureEvent xce = event.xconfigure;
if (xce.window == selected_window_) {
@@ -256,7 +215,7 @@ bool WindowCapturerLinux::HandleXEvent(const XEvent& event) {
@@ -251,7 +211,7 @@ bool WindowCapturerLinux::HandleXEvent(c
return false;
}
@ -2460,7 +2401,7 @@ index a97698dcbd..f3fb28d808 100644
int status;
bool result = false;
XTextProperty window_name;
@@ -285,9 +244,7 @@ bool WindowCapturerLinux::GetWindowTitle(::Window window, std::string* title) {
@@ -280,9 +240,7 @@ bool WindowCapturerLinux::GetWindowTitle
return result;
}
@ -2471,7 +2412,7 @@ index a97698dcbd..f3fb28d808 100644
// 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);
@@ -296,11 +253,11 @@ int WindowCapturerLinux::GetWindowProcessID(::Window window) {
@@ -291,11 +249,11 @@ int WindowCapturerLinux::GetWindowProces
}
// static
@ -2485,12 +2426,10 @@ index a97698dcbd..f3fb28d808 100644
}
} // namespace webrtc
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 @@
diff -up firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h.firefox-pipewire firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h
--- firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h.firefox-pipewire 2019-03-12 15:27:37.680285758 +0100
+++ firefox-66.0/media/webrtc/trunk/webrtc/modules/desktop_capture/window_capturer_x11.h 2019-03-13 08:06:55.974724907 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.
+ *
@ -2532,7 +2471,6 @@ index 0000000000..369c59813e
+
+ // DesktopCapturer interface.
+ void Start(Callback* callback) override;
+ void Stop() override;
+ void CaptureFrame() override;
+ bool GetSourceList(SourceList* sources) override;
+ bool SelectSource(SourceId id) override;

View File

@ -355,7 +355,7 @@ This package contains results of tests executed during build.
# Wayland specific upstream patches
%if 0%{?fedora} > 28
#%patch574 -p1 -b .firefox-pipewire
%patch574 -p1 -b .firefox-pipewire
%endif
%patch575 -p1 -b .mozilla-1423598-popup
%patch576 -p1 -b .mozilla-1532643-popup