#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/base/video_frame.h"
#include <stddef.h>
#include <stdint.h>
#include <array>
#include <memory>
#include <numeric>
#include "base/format_macros.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/aligned_memory.h"
#include "base/memory/read_only_shared_memory_region.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
#include "media/base/color_plane_layout.h"
#include "media/base/simple_sync_token_client.h"
#include "media/video/fake_gpu_memory_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libyuv/include/libyuv.h"
namespace {
void CreateTestY16Frame(const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
void* memory) { … }
media::VideoFrameMetadata GetFullVideoFrameMetadata() { … }
void VerifyVideoFrameMetadataEquality(const media::VideoFrameMetadata& a,
const media::VideoFrameMetadata& b) { … }
}
namespace media {
MD5DigestToBase16;
void InitializeYV12Frame(VideoFrame* frame, double white_to_black) { … }
void ExpectFrameColor(VideoFrame* yv12_frame, uint32_t expect_rgb_color) { … }
void ExpectFrameExtents(VideoPixelFormat format, const char* expected_hash) { … }
TEST(VideoFrame, CreateFrame) { … }
TEST(VideoFrame, CreateZeroInitializedFrame) { … }
TEST(VideoFrame, CreateBlackFrame) { … }
static void FrameNoLongerNeededCallback(bool* triggered) { … }
TEST(VideoFrame, DestructChainOfWrappedVideoFrames) { … }
TEST(VideoFrame, WrapVideoFrame) { … }
TEST(VideoFrame, WrapExternalData) { … }
TEST(VideoFrame, WrapSharedMemory) { … }
TEST(VideoFrame, WrapExternalGpuMemoryBuffer) { … }
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
TEST(VideoFrame, WrapExternalDmabufs) { … }
#endif
TEST(VideoFrame, CheckFrameExtents) { … }
static void TextureCallback(gpu::SyncToken* called_sync_token,
const gpu::SyncToken& release_sync_token) { … }
TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) { … }
TEST(VideoFrame,
TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) { … }
TEST(VideoFrame, IsValidConfig_OddCodedSize) { … }
TEST(VideoFrame, CreateFrame_OddWidth) { … }
TEST(VideoFrame, AllocationSize_OddSize) { … }
TEST(VideoFrame, WrapExternalDataWithInvalidLayout) { … }
TEST(VideoFrameMetadata, MergeMetadata) { … }
TEST(VideoFrameMetadata, ClearTextureMetadata) { … }
TEST(VideoFrameMetadata, PartialMergeMetadata) { … }
}