#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/video/mock_gpu_video_accelerator_factories.h"
#include <memory>
#include "base/atomic_sequence_num.h"
#include "base/memory/ptr_util.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace media {
namespace {
base::AtomicSequenceNumber g_gpu_memory_buffer_id_generator;
class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { … };
}
MockGpuVideoAcceleratorFactories::MockGpuVideoAcceleratorFactories(
gpu::SharedImageInterface* sii)
: … { … }
MockGpuVideoAcceleratorFactories::~MockGpuVideoAcceleratorFactories() = default;
bool MockGpuVideoAcceleratorFactories::IsGpuVideoDecodeAcceleratorEnabled() { … }
bool MockGpuVideoAcceleratorFactories::IsGpuVideoEncodeAcceleratorEnabled() { … }
std::unique_ptr<gfx::GpuMemoryBuffer>
MockGpuVideoAcceleratorFactories::CreateGpuMemoryBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage ) { … }
base::UnsafeSharedMemoryRegion
MockGpuVideoAcceleratorFactories::CreateSharedMemoryRegion(size_t size) { … }
std::unique_ptr<VideoEncodeAccelerator>
MockGpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator() { … }
bool MockGpuVideoAcceleratorFactories::ShouldUseGpuMemoryBuffersForVideoFrames(
bool for_media_stream) const { … }
}