#include "media/capture/video/video_capture_effects_processor.h"
#include <optional>
#include "base/containers/span.h"
#include "base/memory/scoped_refptr.h"
#include "base/sequence_checker.h"
#include "base/types/expected.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/common/sync_token.h"
#include "media/base/video_types.h"
#include "media/capture/video/video_capture_gpu_channel_host.h"
#include "ui/gl/gl_bindings.h"
namespace media {
namespace {
mojom::VideoBufferHandlePtr CreateBufferHandle(
const VideoCaptureDevice::Client::Buffer& buffer,
const mojom::VideoFrameInfo& frame_info,
VideoCaptureBufferType buffer_type,
scoped_refptr<gpu::ClientSharedImage>& shared_image) { … }
}
PostProcessDoneInfo::PostProcessDoneInfo(
VideoCaptureDevice::Client::Buffer buffer,
mojom::VideoFrameInfoPtr info)
: … { … }
PostProcessDoneInfo::PostProcessDoneInfo(PostProcessDoneInfo&& other) = default;
PostProcessDoneInfo& PostProcessDoneInfo::operator=(
PostProcessDoneInfo&& other) = default;
PostProcessDoneInfo::~PostProcessDoneInfo() = default;
VideoCaptureEffectsProcessor::VideoCaptureEffectsProcessor(
mojo::PendingRemote<video_effects::mojom::VideoEffectsProcessor>
video_effects_processor)
: … { … }
VideoCaptureEffectsProcessor::~VideoCaptureEffectsProcessor() { … }
void VideoCaptureEffectsProcessor::PostProcessData(
base::span<const uint8_t> data,
mojom::VideoFrameInfoPtr frame_info,
VideoCaptureDevice::Client::Buffer out_buffer,
const VideoCaptureFormat& out_buffer_format,
VideoCaptureBufferType out_buffer_type,
VideoCaptureEffectsProcessor::PostProcessDoneCallback post_process_cb) { … }
void VideoCaptureEffectsProcessor::PostProcessDataOnValidSequence(
PostProcessContext context,
mojom::VideoBufferHandlePtr in_buffer_handle,
mojom::VideoFrameInfoPtr frame_info,
mojom::VideoBufferHandlePtr out_buffer_handle,
const VideoCaptureFormat& out_buffer_format) { … }
void VideoCaptureEffectsProcessor::PostProcessBuffer(
VideoCaptureDevice::Client::Buffer in_buffer,
mojom::VideoFrameInfoPtr frame_info,
VideoCaptureBufferType in_buffer_type,
VideoCaptureDevice::Client::Buffer out_buffer,
const VideoCaptureFormat& out_buffer_format,
VideoCaptureBufferType out_buffer_type,
VideoCaptureEffectsProcessor::PostProcessDoneCallback post_process_cb) { … }
void VideoCaptureEffectsProcessor::OnPostProcess(
VideoCaptureEffectsProcessor::PostProcessContext context,
video_effects::mojom::PostProcessResultPtr result) { … }
VideoCaptureEffectsProcessor::PostProcessContext::PostProcessContext(
std::optional<VideoCaptureDevice::Client::Buffer> in_buffer,
scoped_refptr<gpu::ClientSharedImage> in_shared_image,
VideoCaptureDevice::Client::Buffer out_buffer,
scoped_refptr<gpu::ClientSharedImage> out_shared_image,
VideoCaptureEffectsProcessor::PostProcessDoneCallback post_process_cb)
: … { … }
VideoCaptureEffectsProcessor::PostProcessContext::PostProcessContext(
VideoCaptureEffectsProcessor::PostProcessContext&& other) = default;
VideoCaptureEffectsProcessor::PostProcessContext::~PostProcessContext() =
default;
}