#include "content/browser/devtools/devtools_video_consumer.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/memory/shared_memory_mapping.h"
#include "cc/paint/skia_paint_canvas.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 "media/base/limits.h"
#include "media/capture/mojom/video_capture_buffer.mojom.h"
#include "media/capture/mojom/video_capture_types.mojom.h"
#include "media/renderers/paint_canvas_video_renderer.h"
namespace content {
namespace {
constexpr base::TimeDelta kDefaultMinCapturePeriod = …;
constexpr base::TimeDelta kDefaultMinPeriod = …;
const bool kDefaultUseFixedAspectRatio = …;
constexpr media::VideoPixelFormat kDefaultPixelFormat = …;
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> CreateCapturer() { … }
}
constexpr gfx::Size DevToolsVideoConsumer::kDefaultMinFrameSize;
constexpr gfx::Size DevToolsVideoConsumer::kDefaultMaxFrameSize;
DevToolsVideoConsumer::DevToolsVideoConsumer(OnFrameCapturedCallback callback)
: … { … }
DevToolsVideoConsumer::~DevToolsVideoConsumer() = default;
SkBitmap DevToolsVideoConsumer::GetSkBitmapFromFrame(
scoped_refptr<media::VideoFrame> frame) { … }
void DevToolsVideoConsumer::StartCapture() { … }
void DevToolsVideoConsumer::StopCapture() { … }
void DevToolsVideoConsumer::SetFrameSinkId(
const viz::FrameSinkId& frame_sink_id) { … }
void DevToolsVideoConsumer::SetMinCapturePeriod(
base::TimeDelta min_capture_period) { … }
void DevToolsVideoConsumer::SetMinAndMaxFrameSize(gfx::Size min_frame_size,
gfx::Size max_frame_size) { … }
void DevToolsVideoConsumer::SetFormat(media::VideoPixelFormat format) { … }
void DevToolsVideoConsumer::InnerStartCapture(
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> capturer) { … }
bool DevToolsVideoConsumer::IsValidMinAndMaxFrameSize(
gfx::Size min_frame_size,
gfx::Size max_frame_size) { … }
void DevToolsVideoConsumer::OnFrameCaptured(
::media::mojom::VideoBufferHandlePtr data,
::media::mojom::VideoFrameInfoPtr info,
const gfx::Rect& content_rect,
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
callbacks) { … }
void DevToolsVideoConsumer::OnStopped() { … }
}