#include "remoting/host/desktop_capturer_proxy.h"
#include <stddef.h>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "remoting/proto/control.pb.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
#include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "remoting/host/chromeos/frame_sink_desktop_capturer.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "base/environment.h"
#include "base/nix/xdg_util.h"
#include "remoting/host/linux/wayland_desktop_capturer.h"
#include "remoting/host/linux/wayland_utils.h"
#endif
namespace remoting {
class DesktopCapturerProxy::Core : public webrtc::DesktopCapturer::Callback { … };
DesktopCapturerProxy::Core::Core(base::WeakPtr<DesktopCapturerProxy> proxy)
: … { … }
DesktopCapturerProxy::Core::~Core() { … }
void DesktopCapturerProxy::Core::CreateCapturer(
const webrtc::DesktopCaptureOptions& options,
SourceId id) { … }
void DesktopCapturerProxy::Core::Start(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner) { … }
void DesktopCapturerProxy::Core::SetSharedMemoryFactory(
std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { … }
void DesktopCapturerProxy::Core::SelectSource(SourceId id) { … }
void DesktopCapturerProxy::Core::CaptureFrame() { … }
void DesktopCapturerProxy::Core::SetMaxFrameRate(uint32_t max_frame_rate) { … }
#if defined(WEBRTC_USE_GIO)
void DesktopCapturerProxy::Core::GetAndSetMetadata() { … }
#endif
void DesktopCapturerProxy::Core::OnFrameCaptureStart() { … }
void DesktopCapturerProxy::Core::OnCaptureResult(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) { … }
DesktopCapturerProxy::DesktopCapturerProxy(
scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner)
: … { … }
DesktopCapturerProxy::~DesktopCapturerProxy() { … }
void DesktopCapturerProxy::CreateCapturer(
const webrtc::DesktopCaptureOptions& options,
SourceId id) { … }
void DesktopCapturerProxy::set_capturer(
std::unique_ptr<webrtc::DesktopCapturer> capturer) { … }
void DesktopCapturerProxy::Start(Callback* callback) { … }
void DesktopCapturerProxy::SetSharedMemoryFactory(
std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { … }
void DesktopCapturerProxy::CaptureFrame() { … }
bool DesktopCapturerProxy::GetSourceList(SourceList* sources) { … }
bool DesktopCapturerProxy::SelectSource(SourceId id) { … }
void DesktopCapturerProxy::OnFrameCaptureStarting() { … }
void DesktopCapturerProxy::OnFrameCaptured(
webrtc::DesktopCapturer::Result result,
std::unique_ptr<webrtc::DesktopFrame> frame) { … }
#if defined(WEBRTC_USE_GIO)
void DesktopCapturerProxy::GetMetadataAsync(
base::OnceCallback<void(webrtc::DesktopCaptureMetadata)> callback) { … }
void DesktopCapturerProxy::OnMetadata(webrtc::DesktopCaptureMetadata metadata) { … }
#endif
bool DesktopCapturerProxy::SupportsFrameCallbacks() { … }
void DesktopCapturerProxy::SetMaxFrameRate(uint32_t max_frame_rate) { … }
}