#include "media/capture/video/video_capture_buffer_pool_impl.h"
#include <memory>
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/memory/platform_shared_memory_region.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "media/capture/video/video_capture_buffer_handle.h"
#include "media/capture/video/video_capture_buffer_pool_util.h"
#include "media/capture/video/video_capture_buffer_tracker.h"
#include "media/capture/video/video_capture_buffer_tracker_factory_impl.h"
#include "media/capture/video/video_capture_device_client.h"
#include "ui/gfx/buffer_format_util.h"
namespace media {
VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl(
VideoCaptureBufferType buffer_type)
: … { … }
VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl(
VideoCaptureBufferType buffer_type,
int count)
: … { … }
VideoCaptureBufferPoolImpl::VideoCaptureBufferPoolImpl(
VideoCaptureBufferType buffer_type,
int count,
std::unique_ptr<VideoCaptureBufferTrackerFactory> buffer_tracker_factory)
: … { … }
VideoCaptureBufferPoolImpl::~VideoCaptureBufferPoolImpl() = default;
base::UnsafeSharedMemoryRegion
VideoCaptureBufferPoolImpl::DuplicateAsUnsafeRegion(int buffer_id) { … }
std::unique_ptr<VideoCaptureBufferHandle>
VideoCaptureBufferPoolImpl::GetHandleForInProcessAccess(int buffer_id) { … }
gfx::GpuMemoryBufferHandle VideoCaptureBufferPoolImpl::GetGpuMemoryBufferHandle(
int buffer_id) { … }
VideoCaptureBufferType VideoCaptureBufferPoolImpl::GetBufferType(
int buffer_id) { … }
VideoCaptureDevice::Client::ReserveResult
VideoCaptureBufferPoolImpl::ReserveForProducer(
const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides,
int frame_feedback_id,
int* buffer_id,
int* buffer_id_to_drop) { … }
void VideoCaptureBufferPoolImpl::RelinquishProducerReservation(int buffer_id) { … }
VideoCaptureDevice::Client::ReserveResult
VideoCaptureBufferPoolImpl::ReserveIdForExternalBuffer(
CapturedExternalVideoBuffer buffer,
const gfx::Size& dimensions,
int* buffer_id_to_drop,
int* buffer_id) { … }
void VideoCaptureBufferPoolImpl::HoldForConsumers(int buffer_id,
int num_clients) { … }
void VideoCaptureBufferPoolImpl::RelinquishConsumerHold(int buffer_id,
int num_clients) { … }
double VideoCaptureBufferPoolImpl::GetBufferPoolUtilization() const { … }
VideoCaptureDevice::Client::ReserveResult
VideoCaptureBufferPoolImpl::ReserveForProducerInternal(
const gfx::Size& dimensions,
VideoPixelFormat pixel_format,
const mojom::PlaneStridesPtr& strides,
int frame_feedback_id,
int* buffer_id,
int* buffer_id_to_drop) { … }
VideoCaptureBufferTracker* VideoCaptureBufferPoolImpl::GetTracker(
int buffer_id) { … }
}