#include "media/gpu/chromeos/platform_video_frame_pool.h"
#include <optional>
#include <utility>
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "media/base/media_switches.h"
#include "media/base/video_util.h"
#include "media/gpu/chromeos/gpu_buffer_layout.h"
#include "media/gpu/chromeos/native_pixmap_frame_resource.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
#include "media/media_buildflags.h"
namespace media {
namespace {
constexpr VideoFrame::StorageType kDefaultFrameStorageType = …;
CroStatus::Or<scoped_refptr<FrameResource>> DefaultCreateFrame(
VideoPixelFormat format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
bool use_protected,
bool use_linear_buffers,
bool needs_detiling,
base::TimeDelta timestamp) { … }
}
PlatformVideoFramePool::PlatformVideoFramePool()
: … { … }
PlatformVideoFramePool::~PlatformVideoFramePool() { … }
scoped_refptr<FrameResource> PlatformVideoFramePool::GetFrame() { … }
VideoFrame::StorageType PlatformVideoFramePool::GetFrameStorageType() const { … }
PlatformVideoFramePool* PlatformVideoFramePool::AsPlatformVideoFramePool() { … }
CroStatus::Or<GpuBufferLayout> PlatformVideoFramePool::Initialize(
const Fourcc& fourcc,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
size_t max_num_frames,
bool use_protected,
bool use_linear_buffers) { … }
void PlatformVideoFramePool::SetCustomFrameAllocator(
DmabufVideoFramePool::CreateFrameCB allocator,
VideoFrame::StorageType frame_storage_type) { … }
bool PlatformVideoFramePool::IsExhausted() { … }
bool PlatformVideoFramePool::IsExhausted_Locked() { … }
FrameResource* PlatformVideoFramePool::GetOriginalFrame(
gfx::GenericSharedMemoryId frame_id) { … }
void PlatformVideoFramePool::NotifyWhenFrameAvailable(base::OnceClosure cb) { … }
void PlatformVideoFramePool::ReleaseAllFrames() { … }
std::optional<GpuBufferLayout> PlatformVideoFramePool::GetGpuBufferLayout() { … }
void PlatformVideoFramePool::OnFrameReleasedThunk(
std::optional<base::WeakPtr<PlatformVideoFramePool>> pool,
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<FrameResource> origin_frame) { … }
void PlatformVideoFramePool::OnFrameReleased(
scoped_refptr<FrameResource> origin_frame) { … }
void PlatformVideoFramePool::InsertFreeFrame_Locked(
scoped_refptr<FrameResource> frame) { … }
size_t PlatformVideoFramePool::GetTotalNumFrames_Locked() const { … }
bool PlatformVideoFramePool::IsSameFormat_Locked(VideoPixelFormat format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
bool use_protected) const { … }
size_t PlatformVideoFramePool::GetPoolSizeForTesting() { … }
}