Changes: 1) Scoped class This is a special class for GLib based objects which we need to manually delete with different functions. Wrapping these objects into Scoped class will destroy them automatically when they go out of scope. 2) Window sharing support Unlike screen sharing, with window sharing we are required to obtain more information from the PipeWire stream, like video crop metadata, which we use to properly set size of our buffer. 3) Support for DmaBuf and MemFd buffer types As of now, we expected the PipeWire stream will provide only plain data which we just need to copy to our buffer. We now add support for new buffer types, which are often preferred for better effeciency. 4) Minor bugfixes: a) Additionally accept PipeWire streams using alpha channels (BGRA, RGBA) b) Add lock over PipeWire loop to prevent potential issues until we fully intialize everything we need c) When obtaining buffers, make sure we work with the latest one Bug: chromium:682122 Change-Id: I64638d5dcbe18e7280550dca0b01b17c511ac98a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194100 Commit-Queue: Jamie Walch <jamiewalch@chromium.org> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Cr-Commit-Position: refs/heads/master@{#32763}
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
/*
|
|
* Copyright 2018 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include <memory>
|
|
|
|
#include "modules/desktop_capture/desktop_capture_options.h"
|
|
#include "modules/desktop_capture/desktop_capturer.h"
|
|
|
|
#if defined(WEBRTC_USE_PIPEWIRE)
|
|
#include "modules/desktop_capture/linux/base_capturer_pipewire.h"
|
|
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
|
|
|
#if defined(WEBRTC_USE_X11)
|
|
#include "modules/desktop_capture/linux/window_capturer_x11.h"
|
|
#endif // defined(WEBRTC_USE_X11)
|
|
|
|
namespace webrtc {
|
|
|
|
// static
|
|
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawWindowCapturer(
|
|
const DesktopCaptureOptions& options) {
|
|
#if defined(WEBRTC_USE_PIPEWIRE)
|
|
if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
|
|
return BaseCapturerPipeWire::CreateRawCapturer(options);
|
|
}
|
|
#endif // defined(WEBRTC_USE_PIPEWIRE)
|
|
|
|
#if defined(WEBRTC_USE_X11)
|
|
return WindowCapturerX11::CreateRawWindowCapturer(options);
|
|
#endif // defined(WEBRTC_USE_X11)
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
} // namespace webrtc
|