This reverts commit e820cef5340610b9beebbcb63868743b95b97fcd. Reason for revert: Breaks downstream client. I will investigate and get back with a suggestion to fix. Original change's description: > Begin implementing WGC CaptureFrame > > This change introduces the design that will allow us to deliver frames > synchronously to callers despite the Windows.Graphics.Capture APIs being > inherently asynchronous. > > We achieve this by having WindowCapturerWinWgc create and maintain a > WgcCaptureSession object for each window that it is asked to capture a > frame for. The capture session object will be the class that actually > uses the WGC APIs, and it will store the frames it receives in a frame > pool and deliver them via GetMostRecentFrame. > > The next CL will add the necessary functionality to the > WgcCaptureSession class. > > Bug: webrtc:9273 > Change-Id: I44e164f4874503d8ccc8e6a210e74f9c8458f6c4 > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184220 > Commit-Queue: Austin Orion <auorion@microsoft.com> > Reviewed-by: Tommi <tommi@webrtc.org> > Cr-Commit-Position: refs/heads/master@{#32240} TBR=mbonadei@webrtc.org,jamiewalch@chromium.org,tommi@webrtc.org,auorion@microsoft.com Change-Id: I114944357ce5be7d1e2da817703dc95d544aa99a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: webrtc:9273 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186045 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32248}
90 lines
2.5 KiB
C++
90 lines
2.5 KiB
C++
/*
|
|
* Copyright (c) 2016 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 "modules/desktop_capture/desktop_capturer.h"
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <cstring>
|
|
#include <utility>
|
|
|
|
#include "modules/desktop_capture/cropping_window_capturer.h"
|
|
#include "modules/desktop_capture/desktop_capture_options.h"
|
|
#include "modules/desktop_capture/desktop_capturer_differ_wrapper.h"
|
|
|
|
namespace webrtc {
|
|
|
|
DesktopCapturer::~DesktopCapturer() = default;
|
|
|
|
void DesktopCapturer::SetSharedMemoryFactory(
|
|
std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
|
|
|
|
void DesktopCapturer::SetExcludedWindow(WindowId window) {}
|
|
|
|
bool DesktopCapturer::GetSourceList(SourceList* sources) {
|
|
return true;
|
|
}
|
|
|
|
bool DesktopCapturer::SelectSource(SourceId id) {
|
|
return false;
|
|
}
|
|
|
|
bool DesktopCapturer::FocusOnSelectedSource() {
|
|
return false;
|
|
}
|
|
|
|
bool DesktopCapturer::IsOccluded(const DesktopVector& pos) {
|
|
return false;
|
|
}
|
|
|
|
// static
|
|
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateWindowCapturer(
|
|
const DesktopCaptureOptions& options) {
|
|
#if defined(WEBRTC_WIN)
|
|
if (options.allow_cropping_window_capturer()) {
|
|
return CroppingWindowCapturer::CreateCapturer(options);
|
|
}
|
|
#endif // defined(WEBRTC_WIN)
|
|
|
|
std::unique_ptr<DesktopCapturer> capturer = CreateRawWindowCapturer(options);
|
|
if (capturer && options.detect_updated_region()) {
|
|
capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
|
}
|
|
|
|
return capturer;
|
|
}
|
|
|
|
// static
|
|
std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateScreenCapturer(
|
|
const DesktopCaptureOptions& options) {
|
|
std::unique_ptr<DesktopCapturer> capturer = CreateRawScreenCapturer(options);
|
|
if (capturer && options.detect_updated_region()) {
|
|
capturer.reset(new DesktopCapturerDifferWrapper(std::move(capturer)));
|
|
}
|
|
|
|
return capturer;
|
|
}
|
|
|
|
#if defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
|
bool DesktopCapturer::IsRunningUnderWayland() {
|
|
const char* xdg_session_type = getenv("XDG_SESSION_TYPE");
|
|
if (!xdg_session_type || strncmp(xdg_session_type, "wayland", 7) != 0)
|
|
return false;
|
|
|
|
if (!(getenv("WAYLAND_DISPLAY")))
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
#endif // defined(WEBRTC_USE_PIPEWIRE) || defined(WEBRTC_USE_X11)
|
|
|
|
} // namespace webrtc
|