#include "services/video_capture/shared_memory_virtual_device_mojo_adapter.h"
#include <utility>
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/ranges/algorithm.h"
#include "media/capture/video/scoped_buffer_pool_reservation.h"
#include "media/capture/video/video_capture_buffer_pool_impl.h"
#include "media/capture/video/video_capture_buffer_pool_util.h"
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/video_capture/public/mojom/constants.mojom.h"
namespace {
void OnNewBufferAcknowleged(
video_capture::mojom::SharedMemoryVirtualDevice::RequestFrameBufferCallback
callback,
int32_t buffer_id) { … }
}
namespace video_capture {
SharedMemoryVirtualDeviceMojoAdapter::SharedMemoryVirtualDeviceMojoAdapter(
mojo::Remote<mojom::Producer> producer)
: … { … }
SharedMemoryVirtualDeviceMojoAdapter::~SharedMemoryVirtualDeviceMojoAdapter() { … }
int SharedMemoryVirtualDeviceMojoAdapter::max_buffer_pool_buffer_count() { … }
void SharedMemoryVirtualDeviceMojoAdapter::RequestFrameBuffer(
const gfx::Size& dimension,
media::VideoPixelFormat pixel_format,
media::mojom::PlaneStridesPtr strides,
RequestFrameBufferCallback callback) { … }
void SharedMemoryVirtualDeviceMojoAdapter::OnFrameReadyInBuffer(
int32_t buffer_id,
::media::mojom::VideoFrameInfoPtr frame_info) { … }
void SharedMemoryVirtualDeviceMojoAdapter::Start(
const media::VideoCaptureParams& requested_settings,
mojo::PendingRemote<mojom::VideoFrameHandler> handler) { … }
void SharedMemoryVirtualDeviceMojoAdapter::StartInProcess(
const media::VideoCaptureParams& requested_settings,
const base::WeakPtr<media::VideoFrameReceiver>& frame_handler,
media::VideoEffectsContext context) { … }
void SharedMemoryVirtualDeviceMojoAdapter::MaybeSuspend() { … }
void SharedMemoryVirtualDeviceMojoAdapter::Resume() { … }
void SharedMemoryVirtualDeviceMojoAdapter::GetPhotoState(
GetPhotoStateCallback callback) { … }
void SharedMemoryVirtualDeviceMojoAdapter::SetPhotoOptions(
media::mojom::PhotoSettingsPtr settings,
SetPhotoOptionsCallback callback) { … }
void SharedMemoryVirtualDeviceMojoAdapter::TakePhoto(
TakePhotoCallback callback) { … }
void SharedMemoryVirtualDeviceMojoAdapter::ProcessFeedback(
const media::VideoCaptureFeedback& feedback) { … }
void SharedMemoryVirtualDeviceMojoAdapter::RequestRefreshFrame() { … }
void SharedMemoryVirtualDeviceMojoAdapter::Stop() { … }
void SharedMemoryVirtualDeviceMojoAdapter::OnReceiverConnectionErrorOrClose() { … }
}