#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/base/mime_util.h"
#include <stddef.h>
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_command_line.h"
#include "build/build_config.h"
#include "media/base/audio_codecs.h"
#include "media/base/media.h"
#include "media/base/media_switches.h"
#include "media/base/mime_util_internal.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif
namespace media::internal {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const bool kUsePropCodecs = true;
#else
const bool kUsePropCodecs = …;
#endif
const char kTestMimeType[] = …;
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(USE_PROPRIETARY_CODECS)
const bool kHlsSupported = true;
#else
const bool kHlsSupported = …;
#endif
static std::vector<bool> CreateTestVector(bool test_all_values,
bool single_value) { … }
template <typename TestCallback>
static void RunCodecSupportTest(const MimeUtil::PlatformInfo& states_to_vary,
const MimeUtil::PlatformInfo& test_states,
TestCallback test_func) { … }
static MimeUtil::PlatformInfo VaryAllFields() { … }
static bool HasDolbyVisionSupport() { … }
static bool HasEac3Support() { … }
static bool HasAc4Support() { … }
static bool HasIamfSupport() { … }
TEST(MimeUtilTest, CommonMediaMimeType) { … }
TEST(MimeUtilTest, SplitAndStripCodecs) { … }
TEST(MimeUtilTest, ParseVideoCodecString) { … }
TEST(MimeUtilTest, ParseVideoCodecString_NoMimeType) { … }
TEST(MimeUtilTest, ParseAudioCodecString) { … }
TEST(MimeUtilTest, ParseAudioCodecString_NoMimeType) { … }
TEST(MimeUtilTest, ParseAudioCodecString_Mp3) { … }
TEST(MimeUtilTest, ParseVideoCodecString_SimpleCodecsHaveProfiles) { … }
TEST(IsCodecSupportedOnAndroidTest, EncryptedCodecBehavior) { … }
TEST(IsCodecSupportedOnAndroidTest, ClearCodecBehavior) { … }
TEST(IsCodecSupportedOnAndroidTest, OpusOggSupport) { … }
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
TEST(IsCodecSupportedOnAndroidTest, HEVCSupport) {
MimeUtil::PlatformInfo info;
info.has_platform_hevc_decoder = false;
EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid(
MimeUtil::HEVC, kTestMimeType, false, VIDEO_CODEC_PROFILE_UNKNOWN, info));
info.has_platform_hevc_decoder = true;
EXPECT_TRUE(MimeUtil::IsCodecSupportedOnAndroid(
MimeUtil::HEVC, kTestMimeType, false, VIDEO_CODEC_PROFILE_UNKNOWN, info));
}
#endif
TEST(IsCodecSupportedOnAndroidTest, AndroidHLSAAC) { … }
}