#include "media/gpu/chromeos/platform_video_frame_pool.h"
#include <drm_fourcc.h>
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "base/functional/callback_helpers.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
#include "media/base/format_utils.h"
#include "media/base/video_types.h"
#include "media/base/video_util.h"
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#include "media/gpu/chromeos/fake_chromeos_intel_compressed_gpu_memory_buffer.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/video_frame_resource.h"
#include "media/video/fake_gpu_memory_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
namespace {
template <uint64_t modifier>
CroStatus::Or<scoped_refptr<FrameResource>> CreateGpuMemoryBufferFrameResource(
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) { … }
CroStatus::Or<scoped_refptr<FrameResource>>
CreateChromeOSCompressedGpuMemoryBufferFrameResource(
uint64_t modifier,
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) { … }
}
class PlatformVideoFramePoolTestBase : public ::testing::Test { … };
class PlatformVideoFramePoolTest
: public PlatformVideoFramePoolTestBase,
public testing::WithParamInterface<VideoPixelFormat> { … };
constexpr VideoPixelFormat kPixelFormats[] = …;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(PlatformVideoFramePoolTest, SingleFrameReuse) { … }
TEST_P(PlatformVideoFramePoolTest, MultipleFrameReuse) { … }
TEST_P(PlatformVideoFramePoolTest, InitializeWithDifferentFourcc) { … }
TEST_P(PlatformVideoFramePoolTest, InitializeWithDifferentUsableArea) { … }
TEST_P(PlatformVideoFramePoolTest, InitializeWithDifferentCodedSize) { … }
TEST_P(PlatformVideoFramePoolTest, GetOriginalFrame) { … }
TEST_P(PlatformVideoFramePoolTest,
InitializeWithSameFourccUsableAreaAndCodedSize) { … }
TEST_P(PlatformVideoFramePoolTest, InitializeFail) { … }
TEST_P(PlatformVideoFramePoolTest, ModifierIsPassed) { … }
class PlatformVideoFramePoolWithMediaCompressionTest
: public PlatformVideoFramePoolTestBase,
public testing::WithParamInterface<
std::tuple<VideoPixelFormat, uint64_t>> { … };
constexpr uint64_t kCompressedBufferModifiers[] = …;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(PlatformVideoFramePoolWithMediaCompressionTest,
CompressedGpuMemoryBufferIsPassed) { … }
}