chromium/content/browser/media/capture/frame_sink_video_capture_device.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/media/capture/frame_sink_video_capture_device.h"

#include <optional>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/token.h"
#include "build/build_config.h"
#include "components/viz/common/surfaces/subtree_capture_id.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/device_service.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "media/base/video_types.h"
#include "media/capture/mojom/video_capture_types.mojom.h"
#include "media/capture/video_capture_types.h"
#include "services/device/public/mojom/wake_lock_provider.mojom.h"

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
#include "content/browser/media/capture/mouse_cursor_overlay_controller.h"
#endif

#if BUILDFLAG(IS_MAC) || defined(USE_AURA)
#include "components/viz/common/gpu/context_provider.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "gpu/command_buffer/common/capabilities.h"
#endif

namespace content {

namespace {

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
constexpr int32_t kMouseCursorStackingIndex =;
#endif

// Transfers ownership of an object to a std::unique_ptr with a custom deleter
// that ensures the object is destroyed on the UI BrowserThread.
template <typename T>
std::unique_ptr<T, BrowserThread::DeleteOnUIThread> RescopeToUIThread(
    std::unique_ptr<T>&& ptr) {}

void BindWakeLockProvider(
    mojo::PendingReceiver<device::mojom::WakeLockProvider> receiver) {}

scoped_refptr<viz::RasterContextProvider> GetContextProvider() {}

}  // namespace

// Helper class that is used to observe the `viz::ContextProvider` for context
// loss events and communicate latest `gpu::Capabilities` after context loss.
class ContextProviderObserver : viz::ContextLostObserver {};

#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
FrameSinkVideoCaptureDevice::FrameSinkVideoCaptureDevice()
    :{}
#else
FrameSinkVideoCaptureDevice::FrameSinkVideoCaptureDevice() = default;
#endif

FrameSinkVideoCaptureDevice::~FrameSinkVideoCaptureDevice() {}

bool FrameSinkVideoCaptureDevice::CanSupportNV12Format() const {}

media::VideoPixelFormat
FrameSinkVideoCaptureDevice::GetDesiredVideoPixelFormat() const {}

void FrameSinkVideoCaptureDevice::ObserveContextProvider() {}

void FrameSinkVideoCaptureDevice::SetGpuCapabilitiesOnDevice(
    std::optional<gpu::Capabilities> capabilities) {}

void FrameSinkVideoCaptureDevice::AllocateAndStartWithReceiver(
    const media::VideoCaptureParams& params,
    std::unique_ptr<media::VideoFrameReceiver> receiver) {}

void FrameSinkVideoCaptureDevice::AllocateAndStartWithReceiverInternal() {}

void FrameSinkVideoCaptureDevice::AllocateCapturer(
    media::VideoPixelFormat pixel_format) {}

void FrameSinkVideoCaptureDevice::AllocateAndStart(
    const media::VideoCaptureParams& params,
    std::unique_ptr<media::VideoCaptureDevice::Client> client) {}

void FrameSinkVideoCaptureDevice::RestartCapturerIfNeeded() {}

void FrameSinkVideoCaptureDevice::RequestRefreshFrame() {}

void FrameSinkVideoCaptureDevice::MaybeSuspend() {}

void FrameSinkVideoCaptureDevice::Resume() {}

void FrameSinkVideoCaptureDevice::ApplySubCaptureTarget(
    media::mojom::SubCaptureTargetType type,
    const base::Token& target,
    uint32_t sub_capture_target_version,
    base::OnceCallback<void(media::mojom::ApplySubCaptureTargetResult)>
        callback) {}

void FrameSinkVideoCaptureDevice::StopAndDeAllocate() {}

void FrameSinkVideoCaptureDevice::OnUtilizationReport(
    media::VideoCaptureFeedback feedback) {}

void FrameSinkVideoCaptureDevice::OnFrameCaptured(
    media::mojom::VideoBufferHandlePtr data,
    media::mojom::VideoFrameInfoPtr info,
    const gfx::Rect& content_rect,
    mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
        callbacks) {}

void FrameSinkVideoCaptureDevice::OnNewSubCaptureTargetVersion(
    uint32_t sub_capture_target_version) {}

void FrameSinkVideoCaptureDevice::OnFrameWithEmptyRegionCapture() {}

void FrameSinkVideoCaptureDevice::OnStopped() {}

void FrameSinkVideoCaptureDevice::OnLog(const std::string& message) {}

void FrameSinkVideoCaptureDevice::OnTargetChanged(
    const std::optional<viz::VideoCaptureTarget>& target,
    uint32_t sub_capture_target_version) {}

void FrameSinkVideoCaptureDevice::OnTargetPermanentlyLost() {}

void FrameSinkVideoCaptureDevice::WillStart() {}

void FrameSinkVideoCaptureDevice::DidStop() {}

void FrameSinkVideoCaptureDevice::CreateCapturer(
    mojo::PendingReceiver<viz::mojom::FrameSinkVideoCapturer> receiver) {}

// static
void FrameSinkVideoCaptureDevice::CreateCapturerViaGlobalManager(
    mojo::PendingReceiver<viz::mojom::FrameSinkVideoCapturer> receiver) {}

void FrameSinkVideoCaptureDevice::MaybeStartConsuming() {}

void FrameSinkVideoCaptureDevice::MaybeStopConsuming() {}

void FrameSinkVideoCaptureDevice::OnFramePropagationComplete(
    BufferId buffer_id) {}

void FrameSinkVideoCaptureDevice::OnFatalError(std::string message) {}

void FrameSinkVideoCaptureDevice::RequestWakeLock() {}

}  // namespace content