зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1496359 - Conflict resolutions for Pipewire support patch; r=ng
Depends on D27368 Differential Revision: https://phabricator.services.mozilla.com/D27369 --HG-- rename : media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_x11.cc => media/webrtc/trunk/webrtc/modules/desktop_capture/app_capturer_linux.cc rename : media/webrtc/trunk/webrtc/modules/desktop_capture/x11/desktop_device_info_x11.cc => media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.cc rename : media/webrtc/trunk/webrtc/modules/desktop_capture/x11/desktop_device_info_x11.h => media/webrtc/trunk/webrtc/modules/desktop_capture/linux/desktop_device_info_x11.h rename : media/webrtc/trunk/webrtc/modules/desktop_capture/x11/shared_x_util.cc => media/webrtc/trunk/webrtc/modules/desktop_capture/linux/shared_x_util.cc rename : media/webrtc/trunk/webrtc/modules/desktop_capture/x11/shared_x_util.h => media/webrtc/trunk/webrtc/modules/desktop_capture/linux/shared_x_util.h extra : moz-landing-system : lando
This commit is contained in:
Родитель
c3c7cc825b
Коммит
971eaccaa1
|
@ -332,39 +332,68 @@ rtc_static_library("desktop_capture_generic") {
|
|||
]
|
||||
}
|
||||
|
||||
if (use_x11 || rtc_use_pipewire) {
|
||||
sources += [
|
||||
"mouse_cursor_monitor_linux.cc",
|
||||
"screen_capturer_linux.cc",
|
||||
"window_capturer_linux.cc",
|
||||
]
|
||||
|
||||
if (build_with_mozilla) {
|
||||
sources += [ "app_capturer_linux.cc" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
sources += [
|
||||
"mouse_cursor_monitor_x11.cc",
|
||||
"screen_capturer_x11.cc",
|
||||
"window_capturer_x11.cc",
|
||||
"window_finder_x11.cc",
|
||||
"window_finder_x11.h",
|
||||
"x11/shared_x_display.cc",
|
||||
"x11/shared_x_display.h",
|
||||
"x11/window_list_utils.cc",
|
||||
"x11/window_list_utils.h",
|
||||
"x11/x_atom_cache.cc",
|
||||
"x11/x_atom_cache.h",
|
||||
"x11/x_error_trap.cc",
|
||||
"x11/x_error_trap.h",
|
||||
"x11/x_server_pixel_buffer.cc",
|
||||
"x11/x_server_pixel_buffer.h",
|
||||
"linux/mouse_cursor_monitor_x11.cc",
|
||||
"linux/mouse_cursor_monitor_x11.h",
|
||||
"linux/screen_capturer_x11.cc",
|
||||
"linux/screen_capturer_x11.h",
|
||||
"linux/shared_x_display.cc",
|
||||
"linux/shared_x_display.h",
|
||||
"linux/window_capturer_x11.cc",
|
||||
"linux/window_capturer_x11.h",
|
||||
"linux/window_finder_x11.cc",
|
||||
"linux/window_finder_x11.h",
|
||||
"linux/window_list_utils.cc",
|
||||
"linux/window_list_utils.h",
|
||||
"linux/x_atom_cache.cc",
|
||||
"linux/x_atom_cache.h",
|
||||
"linux/x_error_trap.cc",
|
||||
"linux/x_error_trap.h",
|
||||
"linux/x_server_pixel_buffer.cc",
|
||||
"linux/x_server_pixel_buffer.h",
|
||||
]
|
||||
configs += [ "//build/config/linux:x11" ]
|
||||
|
||||
if (build_with_mozilla) {
|
||||
sources += [
|
||||
"app_capturer_x11.cc",
|
||||
"app_capturer_x11.h",
|
||||
"x11/desktop_device_info_x11.cc",
|
||||
"x11/desktop_device_info_x11.h",
|
||||
"x11/shared_x_util.cc",
|
||||
"x11/shared_x_util.h",
|
||||
"linux/desktop_device_info_x11.cc",
|
||||
"linux/desktop_device_info_x11.h",
|
||||
"linux/shared_x_util.cc",
|
||||
"linux/shared_x_util.h",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_win && !is_mac && !use_x11) {
|
||||
if (rtc_use_pipewire) {
|
||||
sources += [
|
||||
"linux/base_capturer_pipewire.cc",
|
||||
"linux/base_capturer_pipewire.h",
|
||||
"linux/screen_capturer_pipewire.cc",
|
||||
"linux/screen_capturer_pipewire.h",
|
||||
"linux/window_capturer_pipewire.cc",
|
||||
"linux/window_capturer_pipewire.h",
|
||||
]
|
||||
|
||||
configs += [
|
||||
":gio",
|
||||
":pipewire",
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_win && !is_mac && !use_x11 && !rtc_use_pipewire) {
|
||||
sources += [
|
||||
"mouse_cursor_monitor_null.cc",
|
||||
"screen_capturer_null.cc",
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
#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 "modules/desktop_capture/linux/shared_x_util.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
@ -23,9 +23,9 @@
|
|||
|
||||
#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/x_error_trap.h"
|
||||
#include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include "modules/desktop_capture/linux/x_error_trap.h"
|
||||
#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace webrtc {
|
|
@ -2,13 +2,14 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "modules/desktop_capture/x11/desktop_device_info_x11.h"
|
||||
#include "modules/desktop_capture/linux/desktop_device_info_x11.h"
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.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 "modules/desktop_capture/linux/shared_x_util.h"
|
||||
#include "modules/desktop_capture/linux/x_error_trap.h"
|
||||
#include "modules/desktop_capture/linux/x_server_pixel_buffer.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
|
@ -8,19 +8,21 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include "modules/desktop_capture/linux/mouse_cursor_monitor_x11.h"
|
||||
|
||||
#include "modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "modules/desktop_capture/desktop_capture_types.h"
|
||||
#include "modules/desktop_capture/desktop_frame.h"
|
||||
#include "modules/desktop_capture/linux/x_error_trap.h"
|
||||
#include "modules/desktop_capture/mouse_cursor.h"
|
||||
#include "modules/desktop_capture/x11/x_error_trap.h"
|
||||
#include "modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
namespace {
|
||||
|
@ -60,37 +62,6 @@ Window GetTopLevelWindow(Display* display, Window window) {
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
class MouseCursorMonitorX11 : public MouseCursorMonitor,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window, Window inner_window);
|
||||
~MouseCursorMonitorX11() override;
|
||||
|
||||
void Init(Callback* callback, Mode mode) override;
|
||||
void Capture() override;
|
||||
|
||||
private:
|
||||
// SharedXDisplay::XEventHandler interface.
|
||||
bool HandleXEvent(const XEvent& event) override;
|
||||
|
||||
Display* display() { return x_display_->display(); }
|
||||
|
||||
// Captures current cursor shape and stores it in |cursor_shape_|.
|
||||
void CaptureCursor();
|
||||
|
||||
rtc::scoped_refptr<SharedXDisplay> x_display_;
|
||||
Callback* callback_;
|
||||
Mode mode_;
|
||||
Window window_;
|
||||
Window inner_window_;
|
||||
|
||||
bool have_xfixes_;
|
||||
int xfixes_event_base_;
|
||||
int xfixes_error_base_;
|
||||
|
||||
std::unique_ptr<MouseCursor> cursor_shape_;
|
||||
};
|
||||
|
||||
MouseCursorMonitorX11::MouseCursorMonitorX11(
|
||||
const DesktopCaptureOptions& options,
|
||||
Window window, Window inner_window)
|
||||
|
@ -256,7 +227,7 @@ void MouseCursorMonitorX11::CaptureCursor() {
|
|||
}
|
||||
|
||||
// static
|
||||
MouseCursorMonitor* MouseCursorMonitor::CreateForWindow(
|
||||
MouseCursorMonitor* MouseCursorMonitorX11::CreateForWindow(
|
||||
const DesktopCaptureOptions& options, WindowId window) {
|
||||
if (!options.x_display())
|
||||
return NULL;
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace webrtc {
|
|||
class MouseCursorMonitorX11 : public MouseCursorMonitor,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window);
|
||||
MouseCursorMonitorX11(const DesktopCaptureOptions& options, Window window,
|
||||
Window inner_window);
|
||||
~MouseCursorMonitorX11() override;
|
||||
|
||||
static MouseCursorMonitor* CreateForWindow(
|
||||
|
@ -51,6 +52,7 @@ class MouseCursorMonitorX11 : public MouseCursorMonitor,
|
|||
Callback* callback_;
|
||||
Mode mode_;
|
||||
Window window_;
|
||||
Window inner_window_;
|
||||
|
||||
bool have_xfixes_;
|
||||
int xfixes_event_base_;
|
||||
|
|
|
@ -8,123 +8,37 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "modules/desktop_capture/linux/screen_capturer_x11.h"
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#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/linux/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 "modules/desktop_capture/x11/x_server_pixel_buffer.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/timeutils.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
|
||||
// A class to perform video frame capturing for Linux.
|
||||
//
|
||||
// If XDamage is used, this class sets DesktopFrame::updated_region() according
|
||||
// to the areas reported by XDamage. Otherwise this class does not detect
|
||||
// DesktopFrame::updated_region(), the field is always set to the entire frame
|
||||
// rectangle. ScreenCapturerDifferWrapper should be used if that functionality
|
||||
// is necessary.
|
||||
class ScreenCapturerLinux : public DesktopCapturer,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
ScreenCapturerLinux();
|
||||
~ScreenCapturerLinux() override;
|
||||
|
||||
// TODO(ajwong): Do we really want this to be synchronous?
|
||||
bool Init(const DesktopCaptureOptions& options);
|
||||
|
||||
// DesktopCapturer interface.
|
||||
void Start(Callback* delegate) override;
|
||||
void CaptureFrame() override;
|
||||
bool GetSourceList(SourceList* sources) override;
|
||||
bool SelectSource(SourceId id) override;
|
||||
|
||||
private:
|
||||
Display* display() { return options_.x_display()->display(); }
|
||||
|
||||
// SharedXDisplay::XEventHandler interface.
|
||||
bool HandleXEvent(const XEvent& event) override;
|
||||
|
||||
void InitXDamage();
|
||||
|
||||
// Capture screen pixels to the current buffer in the queue. In the DAMAGE
|
||||
// case, the ScreenCapturerHelper already holds the list of invalid rectangles
|
||||
// from HandleXEvent(). In the non-DAMAGE case, this captures the
|
||||
// whole screen, then calculates some invalid rectangles that include any
|
||||
// differences between this and the previous capture.
|
||||
std::unique_ptr<DesktopFrame> CaptureScreen();
|
||||
|
||||
// Called when the screen configuration is changed.
|
||||
void ScreenConfigurationChanged();
|
||||
|
||||
// Synchronize the current buffer with |last_buffer_|, by copying pixels from
|
||||
// the area of |last_invalid_rects|.
|
||||
// Note this only works on the assumption that kNumBuffers == 2, as
|
||||
// |last_invalid_rects| holds the differences from the previous buffer and
|
||||
// the one prior to that (which will then be the current buffer).
|
||||
void SynchronizeFrame();
|
||||
|
||||
void DeinitXlib();
|
||||
|
||||
DesktopCaptureOptions options_;
|
||||
|
||||
Callback* callback_ = nullptr;
|
||||
|
||||
// X11 graphics context.
|
||||
GC gc_ = nullptr;
|
||||
Window root_window_ = BadValue;
|
||||
|
||||
// XFixes.
|
||||
bool has_xfixes_ = false;
|
||||
int xfixes_event_base_ = -1;
|
||||
int xfixes_error_base_ = -1;
|
||||
|
||||
// XDamage information.
|
||||
bool use_damage_ = false;
|
||||
Damage damage_handle_ = 0;
|
||||
int damage_event_base_ = -1;
|
||||
int damage_error_base_ = -1;
|
||||
XserverRegion damage_region_ = 0;
|
||||
|
||||
// Access to the X Server's pixel buffer.
|
||||
XServerPixelBuffer x_server_pixel_buffer_;
|
||||
|
||||
// A thread-safe list of invalid rectangles, and the size of the most
|
||||
// recently captured screen.
|
||||
ScreenCapturerHelper helper_;
|
||||
|
||||
// Queue of the frames buffers.
|
||||
ScreenCaptureFrameQueue<SharedDesktopFrame> queue_;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
ScreenCapturerLinux::~ScreenCapturerLinux() {
|
||||
ScreenCapturerX11::~ScreenCapturerX11() {
|
||||
options_.x_display()->RemoveEventHandler(ConfigureNotify, this);
|
||||
if (use_damage_) {
|
||||
options_.x_display()->RemoveEventHandler(
|
||||
|
@ -133,7 +47,7 @@ ScreenCapturerLinux::~ScreenCapturerLinux() {
|
|||
DeinitXlib();
|
||||
}
|
||||
|
||||
bool ScreenCapturerLinux::Init(const DesktopCaptureOptions& options) {
|
||||
bool ScreenCapturerX11::Init(const DesktopCaptureOptions& options) {
|
||||
options_ = options;
|
||||
|
||||
root_window_ = RootWindow(display(), DefaultScreen(display()));
|
||||
|
@ -217,14 +131,14 @@ void ScreenCapturerX11::InitXDamage() {
|
|||
RTC_LOG(LS_INFO) << "Using XDamage extension.";
|
||||
}
|
||||
|
||||
void ScreenCapturerLinux::Start(Callback* callback) {
|
||||
void ScreenCapturerX11::Start(Callback* callback) {
|
||||
RTC_DCHECK(!callback_);
|
||||
RTC_DCHECK(callback);
|
||||
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
void ScreenCapturerLinux::CaptureFrame() {
|
||||
void ScreenCapturerX11::CaptureFrame() {
|
||||
int64_t capture_start_time_nanos = rtc::TimeNanos();
|
||||
|
||||
queue_.MoveToNextFrame();
|
||||
|
@ -348,7 +262,7 @@ std::unique_ptr<DesktopFrame> ScreenCapturerX11::CaptureScreen() {
|
|||
return std::move(frame);
|
||||
}
|
||||
|
||||
void ScreenCapturerLinux::ScreenConfigurationChanged() {
|
||||
void ScreenCapturerX11::ScreenConfigurationChanged() {
|
||||
// Make sure the frame buffers will be reallocated.
|
||||
queue_.Reset();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/desktop_capture/x11/shared_x_util.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_X11_SHARED_X_UTIL_H_
|
||||
|
||||
#include "system_wrappers/include/atomic32.h"
|
||||
#include "modules/desktop_capture/x11/shared_x_display.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
|
@ -8,73 +8,28 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "modules/desktop_capture/linux/window_capturer_x11.h"
|
||||
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#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/window_finder_x11.h"
|
||||
#include "modules/desktop_capture/x11/shared_x_display.h"
|
||||
#include "modules/desktop_capture/x11/window_list_utils.h"
|
||||
#include "modules/desktop_capture/x11/x_atom_cache.h"
|
||||
#include "modules/desktop_capture/x11/x_server_pixel_buffer.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include "modules/desktop_capture/linux/window_finder_x11.h"
|
||||
#include "modules/desktop_capture/linux/window_list_utils.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/scoped_ref_ptr.h"
|
||||
#include "modules/desktop_capture/x11/shared_x_util.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_util.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
|
||||
class WindowCapturerLinux : public DesktopCapturer,
|
||||
public SharedXDisplay::XEventHandler {
|
||||
public:
|
||||
WindowCapturerLinux(const DesktopCaptureOptions& options);
|
||||
~WindowCapturerLinux() override;
|
||||
|
||||
// DesktopCapturer interface.
|
||||
void Start(Callback* callback) override;
|
||||
void CaptureFrame() override;
|
||||
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;
|
||||
|
||||
private:
|
||||
Display* display() { return x_display_->display(); }
|
||||
|
||||
// Returns window title for the specified X |window|.
|
||||
bool GetWindowTitle(::Window window, std::string* title);
|
||||
|
||||
// Returns the id of the owning process.
|
||||
int GetWindowProcessID(::Window window);
|
||||
|
||||
Callback* callback_ = nullptr;
|
||||
|
||||
rtc::scoped_refptr<SharedXDisplay> x_display_;
|
||||
|
||||
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()),
|
||||
atom_cache_(display()),
|
||||
window_finder_(&atom_cache_) {
|
||||
|
@ -91,11 +46,11 @@ WindowCapturerLinux::WindowCapturerLinux(const DesktopCaptureOptions& options)
|
|||
x_display_->AddEventHandler(ConfigureNotify, this);
|
||||
}
|
||||
|
||||
WindowCapturerLinux::~WindowCapturerLinux() {
|
||||
WindowCapturerX11::~WindowCapturerX11() {
|
||||
x_display_->RemoveEventHandler(ConfigureNotify, this);
|
||||
}
|
||||
|
||||
bool WindowCapturerLinux::GetSourceList(SourceList* sources) {
|
||||
bool WindowCapturerX11::GetSourceList(SourceList* sources) {
|
||||
return GetWindowList(&atom_cache_,
|
||||
[this, sources](::Window window) {
|
||||
Source w;
|
||||
|
@ -178,14 +133,14 @@ bool WindowCapturerX11::FocusOnSelectedSource() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void WindowCapturerLinux::Start(Callback* callback) {
|
||||
void WindowCapturerX11::Start(Callback* callback) {
|
||||
RTC_DCHECK(!callback_);
|
||||
RTC_DCHECK(callback);
|
||||
|
||||
callback_ = callback;
|
||||
}
|
||||
|
||||
void WindowCapturerLinux::CaptureFrame() {
|
||||
void WindowCapturerX11::CaptureFrame() {
|
||||
x_display_->ProcessPendingXEvents();
|
||||
|
||||
if (!x_server_pixel_buffer_.IsWindowValid()) {
|
||||
|
@ -228,12 +183,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 (xce.window == selected_window_) {
|
||||
|
@ -280,9 +235,7 @@ bool WindowCapturerX11::GetWindowTitle(::Window window, std::string* title) {
|
|||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int WindowCapturerLinux::GetWindowProcessID(::Window window) {
|
||||
int WindowCapturerX11::GetWindowProcessID(::Window window) {
|
||||
// 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);
|
||||
|
@ -291,11 +244,11 @@ int WindowCapturerLinux::GetWindowProcessID(::Window window) {
|
|||
}
|
||||
|
||||
// static
|
||||
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
|
||||
std::unique_ptr<DesktopCapturer> WindowCapturerX11::CreateRawWindowCapturer(
|
||||
const DesktopCaptureOptions& options) {
|
||||
if (!options.x_display())
|
||||
return nullptr;
|
||||
return std::unique_ptr<DesktopCapturer>(new WindowCapturerLinux(options));
|
||||
return std::unique_ptr<DesktopCapturer>(new WindowCapturerX11(options));
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -49,6 +49,9 @@ class WindowCapturerX11 : public DesktopCapturer,
|
|||
// Returns window title for the specified X |window|.
|
||||
bool GetWindowTitle(::Window window, std::string* title);
|
||||
|
||||
// Returns the id of the owning process.
|
||||
int GetWindowProcessID(::Window window);
|
||||
|
||||
Callback* callback_ = nullptr;
|
||||
|
||||
rtc::scoped_refptr<SharedXDisplay> x_display_;
|
||||
|
|
|
@ -8,9 +8,11 @@
|
|||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "modules/desktop_capture/window_finder_x11.h"
|
||||
#include "modules/desktop_capture/linux/window_finder_x11.h"
|
||||
|
||||
#include "modules/desktop_capture/x11/window_list_utils.h"
|
||||
#include <memory>
|
||||
|
||||
#include "modules/desktop_capture/linux/window_list_utils.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include "modules/desktop_capture/screen_drawer.h"
|
||||
#include "modules/desktop_capture/screen_drawer_lock_posix.h"
|
||||
#include "modules/desktop_capture/x11/shared_x_display.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#include "system_wrappers/include/sleep.h"
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include "test/gtest.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include "modules/desktop_capture/x11/shared_x_display.h"
|
||||
#include "modules/desktop_capture/x11/x_atom_cache.h"
|
||||
#include "modules/desktop_capture/linux/shared_x_display.h"
|
||||
#include "modules/desktop_capture/linux/x_atom_cache.h"
|
||||
#include "rtc_base/ptr_util.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -70,6 +70,9 @@ declare_args() {
|
|||
# Set this to true to enable BWE test logging.
|
||||
rtc_enable_bwe_test_logging = false
|
||||
|
||||
# Set this to use PipeWire on the Wayland display server.
|
||||
rtc_use_pipewire = false
|
||||
|
||||
rtc_enable_android_opensl = false
|
||||
|
||||
# Link-Time Optimizations.
|
||||
|
@ -196,7 +199,8 @@ rtc_libyuv_dir = "/media/libyuv/libyuv"
|
|||
rtc_opus_dir = "//third_party/opus"
|
||||
|
||||
# Desktop capturer is supported only on Windows, OSX and Linux.
|
||||
rtc_desktop_capture_supported = is_win || is_mac || (is_linux && use_x11) || is_bsd
|
||||
rtc_desktop_capture_supported =
|
||||
is_win || is_mac || (is_linux && use_x11) || is_bsd || rtc_use_pipewire
|
||||
|
||||
###############################################################################
|
||||
# Templates
|
||||
|
|
Загрузка…
Ссылка в новой задаче