M128 stage 7

This commit is contained in:
Alexander Frick 2024-10-03 12:47:04 -05:00
parent e8eb255937
commit 314b17e659
11 changed files with 194 additions and 1240 deletions

View file

@ -1,381 +0,0 @@
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/cast.gni")
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/args.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/gpu/args.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//third_party/libaom/options.gni")
# This flag sets defaults for the current generation of cast devices.
is_cast_media_device = is_castos || is_cast_android
# Out-of-process video decoding is a feature specific to Linux and ChromeOS
# which makes the interaction with platform drivers (for the purposes of
# hardware accelerated video decoding) happen on utility processes for stability
# and security purposes. When |allow_oop_video_decoder| is true, code to
# use this feature is compiled. Note that even if |allow_oop_video_decoder| is
# true, the feature may be disabled by a runtime flag.
#
# When |allow_hosting_oop_video_decoder| is true, code to host the video decoder
# utility processes is compiled. Note that even if
# |allow_hosting_oop_video_decoder| is true, the hosting of these utility
# processes may be disabled by a runtime flag.
#
# TODO(b/195769334): finish replacing usages of (is_linux || is_chromeos) with
# allow_oop_video_decoder where appropriate. Also, finish replacing usages of
# (is_linux || is_chromeos_ash) with allow_hosting_oop_video_decoder where
# appropriate.
allow_hosting_oop_video_decoder =
(is_chromeos_ash || is_linux) && (use_vaapi || use_v4l2_codec)
allow_oop_video_decoder = is_chromeos_lacros || allow_hosting_oop_video_decoder
declare_args() {
# Allows distributions to link pulseaudio directly (DT_NEEDED) instead of
# using dlopen. This helps with automated detection of ABI mismatches and
# prevents silent errors.
link_pulseaudio = false
# Enable usage of FFmpeg within the media library. Used for most software
# based decoding, demuxing, and sometimes optimized FFTs. If disabled,
# implementors must provide their own demuxers and decoders.
media_use_ffmpeg = true
# Enable usage of libvpx within the media library. Used for software based
# decoding of VP9 and VP8A type content.
media_use_libvpx = true
# non-blink builds doesn't use ffmpeg, libvpx.
if (!use_blink) {
media_use_ffmpeg = false
media_use_libvpx = false
}
# Enable usage of OpenH264 within the media library. Used for software based
# encoding of H264 content.
media_use_openh264 = true
if (is_ios || is_android || !proprietary_codecs) {
media_use_openh264 = false
}
# Override to dynamically link the cras (ChromeOS audio) library.
use_cras = is_chromeos_device
# Enables AC3/EAC3 audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_ac3_eac3_audio = proprietary_codecs && is_cast_media_device
# Enables AC4 audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_ac4_audio = false
enable_platform_mpeg_h_audio = proprietary_codecs && is_cast_media_device
# Enables DTS/DTSX audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_dts_audio = false
# Enables IAMF audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_iamf_audio = false
# Enable Dolby Vision demuxing. Enabled by default for Chromecast and Windows.
# Actual decoding must be provided by the platform. Since most Dolby Vision
# profiles use HEVC, `enable_platform_hevc` is required to enable this.
#
# TODO(crbug.com/1336055): Revisit the default value for this setting as it
# applies to video-capable devices.
enable_platform_dolby_vision =
proprietary_codecs && (is_cast_media_device || is_win)
# Enable platform support of encrypted Dolby Vision. The actual support
# depends on platform capability and is controlled by the run time feature
# kPlatformEncryptedDolbyVision. Clear Dolby Vision is not supported by
# default, unless overwritten by the run time feature
# kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled.
enable_platform_encrypted_dolby_vision = proprietary_codecs && is_win
# Enable logging override, e.g. enable DVLOGs through level 2 at build time.
# On Cast devices, these are logged as INFO.
# When enabled on Fuchsia, these are logged as VLOGs.
enable_logging_override = is_cast_media_device
enable_dav1d_decoder = use_blink
# Enable browser managed persistent metadata storage for EME persistent
# session and persistent usage record session.
enable_media_drm_storage = is_android || is_castos
# Enable HLS manifest parser and demuxer.
enable_hls_demuxer = proprietary_codecs && is_android
# Enable inclusion of the HEVC/H265 parser and also enable HEVC/H265 decoding
# with hardware acceleration assist. Enabled by default for fuzzer builds,
# Windows, Mac, and Android.
enable_hevc_parser_and_hw_decoder =
proprietary_codecs &&
(use_fuzzing_engine || is_win || is_apple || is_android || is_linux)
# Enable inclusion of VVC/H.266 parser/demuxer, and also enable VVC/H.266 decoding
# with hardware acceleration provided by platform. Disabled by default for all builds.
enable_platform_vvc = false
}
# Use another declare_args() to allow dependence on args defined above.
declare_args() {
# If overriding this to false, possibly via its component values,
# `enable_libaom` should likely also be overriddent to false.
enable_av1_decoder = enable_dav1d_decoder
# Enable HEVC/H265 demuxing. Actual decoding must be provided by the
# platform. Always enable this for Lacros, it determines support at runtime.
# TODO(crbug.com/1336055): Revisit the default value for this setting as it
# applies to video-capable devices.
enable_platform_hevc =
proprietary_codecs && (enable_hevc_parser_and_hw_decoder ||
is_cast_media_device || is_chromeos_lacros)
enable_mse_mpeg2ts_stream_parser =
proprietary_codecs &&
(enable_hls_demuxer || enable_cast_receiver || use_fuzzing_engine)
}
declare_args() {
platform_has_optional_hevc_support =
enable_platform_hevc &&
(is_win || is_chromeos || is_linux || is_apple || is_android)
}
assert(!enable_hls_demuxer || enable_mse_mpeg2ts_stream_parser,
"enable_mse_mpeg2ts_stream_parser required for enable_hls_demuxer")
assert(!enable_hls_demuxer || proprietary_codecs,
"proprietary_codecs required for enable_hls_demuxer")
assert(!enable_platform_ac3_eac3_audio || proprietary_codecs,
"proprietary_codecs required for enable_platform_ac3_eac3_audio")
assert(!enable_platform_ac4_audio || proprietary_codecs,
"proprietary_codecs required for enable_platform_ac4_audio")
assert(!enable_platform_mpeg_h_audio || proprietary_codecs,
"proprietary_codecs required for enable_platform_mpeg_h_audio")
assert(!enable_mse_mpeg2ts_stream_parser || proprietary_codecs,
"proprietary_codecs required for enable_mse_mpeg2ts_stream_parser")
assert(!enable_platform_dolby_vision || proprietary_codecs,
"proprietary_codecs required for enable_platform_dolby_vision")
assert(
!enable_platform_encrypted_dolby_vision || enable_platform_dolby_vision,
"enable_platform_dolby_vision required for enable_platform_encrypted_dolby_vision")
assert(!enable_platform_dts_audio || proprietary_codecs,
"proprietary_codecs required for enable_platform_dts_audio")
assert(!enable_platform_hevc || proprietary_codecs,
"proprietary_codecs required for enable_platform_hevc")
assert(!enable_hevc_parser_and_hw_decoder || enable_platform_hevc,
"enable_platform_hevc required for enable_hevc_parser_and_hw_decoder")
# Most DolbyVision profiles (4, 5, 7, 8, not 9) require HEVC support. It's very
# unlikely that we support DolbyVision on a new platform without requiring HEVC
# support. See for details:
# https://professionalsupport.dolby.com/s/article/What-is-Dolby-Vision-Profile
assert(!enable_platform_dolby_vision || enable_platform_hevc,
"enable_platform_hevc required for enable_platform_dolby_vision")
# Use another declare_args() to pick up possible overrides of |use_cras|.
declare_args() {
# Enables runtime selection of PulseAudio library.
use_pulseaudio = false
# Enables runtime selection of ALSA library for audio.
use_alsa = false
# Alsa should be used on all non-Android, non-Mac POSIX systems - with the
# exception of CastOS desktop builds.
#
# TODO(crbug.com/1336055): Remove legacy target_cpu hack used for targeting
# desktop Chromecast builds.
if (is_posix && !is_android && !is_apple &&
(!is_castos || (target_cpu == "x86" || target_cpu == "x64") ||
is_cast_audio_only)) {
use_alsa = true
# Pulse is not supported on Chromecast platforms.
#
# ASAN and TSAN will occasionally hang during pa_context_connect(), so we
# disable PulseAudio when these configurations are enabled.
#
# TODO(crbug.com/40636948): We shouldn't have to do this, but it's unclear why
# our test bots are hanging and all of the ones that don't hang just fall
# back to ALSA after a connection error anyways.
if (!use_cras && !is_castos && !is_asan && !is_tsan) {
use_pulseaudio = true
}
}
}
# Use another declare_args() to include possible overrides of media_use_ffmpeg
# from --args command line flags in the evaluation. See "gn help declare_args".
declare_args() {
# On Android, FFMpeg is built without video decoders by default.
# This flag gives the option to override that decision in case there are no
# hardware decoders. To do so, you will also need to update ffmpeg build files
# in order to define which decoders to build in.
enable_ffmpeg_video_decoders = media_use_ffmpeg && !is_android
}
declare_args() {
# Enables the use of library CDMs that implements the interface defined at
# media/cdm/api/content_decryption_module.h. If true, the actually library CDM
# will be hosted in the mojo CDM service running in the CDM (utility) process.
# Used for all desktop platforms.
enable_library_cdms = toolkit_views && !is_castos
}
# Use another declare_args() to allow dependence on `enable_library_cdms`.
declare_args() {
# Enables host verification for CDMs.
# Windows and Mac.
enable_cdm_host_verification =
enable_library_cdms && (is_mac || is_win) && is_chrome_branded &&
!is_chrome_for_testing_branded
# Enable Storage ID which is used by CDMs. This is only available with chrome
# branding, but may be overridden by other embedders.
enable_cdm_storage_id = enable_library_cdms && is_chrome_branded &&
(is_win || is_mac || is_chromeos)
# If |enable_cdm_storage_id| is set, then an implementation specific key
# must also be provided. It can be provided by defining CDM_STORAGE_ID_KEY
# (which takes precedence), or by setting |alternate_cdm_storage_id_key|.
# The key must be a string of at least 32 characters.
alternate_cdm_storage_id_key = ""
}
assert(!enable_cdm_host_verification || is_mac || is_win,
"CDM host verification is only supported on Mac and Windows.")
# https://crbug.com/1475137#c37
assert(!is_chrome_for_testing_branded || !enable_cdm_host_verification,
"Chrome for Testing is incompatible with CDM Host Verification.")
# Default |mojo_media_services| and |mojo_media_host| on various platforms. See
# comments below for valid values. Can be overridden by gn build arguments from
# the --args command line flag.
_default_mojo_media_services = []
_default_mojo_media_host = ""
if (is_cast_media_device) {
_default_mojo_media_services = cast_mojo_media_services
_default_mojo_media_host = cast_mojo_media_host
} else if (is_android) {
_default_mojo_media_services = [
"cdm",
"audio_decoder",
"audio_encoder",
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_apple || is_win) {
_default_mojo_media_services = [
"audio_decoder",
"audio_encoder",
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_win) {
_default_mojo_media_services = [
"audio_encoder",
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_chromeos_ash || ((is_linux || is_chromeos_lacros) &&
(use_vaapi || use_v4l2_codec))) {
_default_mojo_media_services = [ "video_decoder" ]
_default_mojo_media_host = "gpu"
}
# When |enable_library_cdms| is true, the "cdm" service will run in a separate
# CdmService in the CDM (utility) process. Therefore there's no need to specify
# |_default_mojo_media_host| which controls where the MediaService runs in.
if (enable_library_cdms) {
_default_mojo_media_services += [ "cdm" ]
}
declare_args() {
# A list of mojo media services that should be used in the media pipeline.
# Valid entries in the list are:
# - "renderer": Use mojo-based media Renderer service.
# - "cdm": Use mojo-based Content Decryption Module.
# - "audio_decoder": Use mojo-based audio decoder in the default media
# Renderer. Cannot be used with the mojo Renderer above.
# - "video_decoder": Use mojo-based video decoder in the default media
# Renderer. Cannot be used with the mojo Renderer above.
mojo_media_services = _default_mojo_media_services
# The process that the mojo MediaService runs in. By default, all services
# registered in |mojo_media_services| are hosted in the MediaService, with the
# exception that when |enable_library_cdms| is true, the "cdm" service will
# run in a separate CdmService in the CDM (utility) process, while other
# |mojo_media_services| still run in the MediaService in the process specified
# by "mojo_media_host".
# Valid options are:
# - "browser": Use mojo media service hosted in the browser process.
# - "gpu": Use mojo media service hosted in the gpu process.
# - "": Do not use mojo media service.
mojo_media_host = _default_mojo_media_host
}
declare_args() {
# This switch defines whether the Media Remoting implementation will be built.
# When enabled, media is allowed to be renderer and played back on remote
# devices when the tab is being casted and other conditions are met.
enable_media_remoting = !is_cast_media_device && !is_ios
}
declare_args() {
# Media Remoting RPC is disabled on Android since it's unused but increases
# the native binary size by ~70Kb.
enable_media_remoting_rpc = enable_media_remoting && !is_android
}
declare_args() {
# Currently it is available on Win, Mac and Linux, since it requires the audio
# service to run in a separate process.
chrome_wide_echo_cancellation_supported = is_win || is_mac || is_linux
}
# Do not expand this list without double-checking with OWNERS, this is a list of
# all targets which roll up into the //media component. It controls visibility
# of subcomponent targets and public_deps for //media.
media_subcomponent_deps = [
"//media/audio",
"//media/base",
# TODO(crbug.com/41237623): These files should not be in //media/base.
"//media/base/android",
"//media/capabilities",
"//media/cdm",
"//media/device_monitors",
"//media/filters",
"//media/formats",
"//media/muxers",
"//media/renderers",
"//media/video",
]
if (is_fuchsia) {
media_subcomponent_deps += [ "//media/fuchsia/common" ]
}
if (media_use_ffmpeg) {
media_subcomponent_deps += [ "//media/ffmpeg" ]
}
if (enable_library_cdms || is_win) {
media_subcomponent_deps += [ "//media/cdm:cdm_type_conversion" ]
}
if (is_win) {
media_subcomponent_deps += [ "//media/base/win:media_foundation_util" ]
}

View file

@ -1,432 +0,0 @@
// Copyright 2024 The Chromium Authors, Alex313031, and midzer
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/supported_types.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
#include "ui/display/display_switches.h"
#include "ui/gfx/hdr_metadata.h"
#if BUILDFLAG(ENABLE_LIBVPX)
// TODO(dalecurtis): This technically should not be allowed in media/base. See
// TODO below about moving outside of base.
#include "third_party/libvpx/source/libvpx/vpx/vp8dx.h" // nogncheck
#include "third_party/libvpx/source/libvpx/vpx/vpx_codec.h" // nogncheck
#endif
#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
// TODO(dalecurtis): This include is not allowed by media/base since
// media/base/android is technically a different component. We should move
// supported_types*.{cc,h} out of media/base to fix this.
#include "media/base/android/media_codec_util.h" // nogncheck
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
namespace media {
namespace {
template <typename T>
class SupplementalProfileCache {
public:
void UpdateCache(const base::flat_set<T>& profiles) {
base::AutoLock lock(profiles_lock_);
profiles_ = profiles;
}
bool IsProfileSupported(T profile) {
base::AutoLock lock(profiles_lock_);
return profiles_.find(profile) != profiles_.end();
}
private:
base::Lock profiles_lock_;
base::flat_set<T> profiles_ GUARDED_BY(profiles_lock_);
};
SupplementalProfileCache<VideoCodecProfile>* GetSupplementalProfileCache() {
static base::NoDestructor<SupplementalProfileCache<VideoCodecProfile>> cache;
return cache.get();
}
SupplementalProfileCache<AudioType>* GetSupplementalAudioTypeCache() {
static base::NoDestructor<SupplementalProfileCache<AudioType>> cache;
return cache.get();
}
bool IsSupportedHdrMetadata(const VideoType& type) {
switch (type.hdr_metadata_type) {
case gfx::HdrMetadataType::kNone:
return true;
case gfx::HdrMetadataType::kSmpteSt2086:
// HDR metadata is currently only used with the PQ transfer function.
// See gfx::ColorTransform for more details.
return type.color_space.transfer ==
VideoColorSpace::TransferID::SMPTEST2084;
// 2094-10 SEI metadata is not the same as Dolby Vision RPU metadata, Dolby
// Vision decoders on each platform only support Dolby Vision RPU metadata.
case gfx::HdrMetadataType::kSmpteSt2094_10:
case gfx::HdrMetadataType::kSmpteSt2094_40:
return false;
}
}
bool IsColorSpaceSupported(const VideoColorSpace& color_space) {
switch (color_space.primaries) {
case VideoColorSpace::PrimaryID::EBU_3213_E:
case VideoColorSpace::PrimaryID::INVALID:
return false;
// Transfers supported before color management.
case VideoColorSpace::PrimaryID::BT709:
case VideoColorSpace::PrimaryID::UNSPECIFIED:
case VideoColorSpace::PrimaryID::BT470M:
case VideoColorSpace::PrimaryID::BT470BG:
case VideoColorSpace::PrimaryID::SMPTE170M:
break;
// Supported with color management.
case VideoColorSpace::PrimaryID::SMPTE240M:
case VideoColorSpace::PrimaryID::FILM:
case VideoColorSpace::PrimaryID::BT2020:
case VideoColorSpace::PrimaryID::SMPTEST428_1:
case VideoColorSpace::PrimaryID::SMPTEST431_2:
case VideoColorSpace::PrimaryID::SMPTEST432_1:
break;
}
switch (color_space.transfer) {
// Transfers supported before color management.
case VideoColorSpace::TransferID::UNSPECIFIED:
case VideoColorSpace::TransferID::GAMMA22:
case VideoColorSpace::TransferID::BT709:
case VideoColorSpace::TransferID::SMPTE170M:
case VideoColorSpace::TransferID::BT2020_10:
case VideoColorSpace::TransferID::BT2020_12:
case VideoColorSpace::TransferID::IEC61966_2_1:
break;
// Supported with color management.
case VideoColorSpace::TransferID::GAMMA28:
case VideoColorSpace::TransferID::SMPTE240M:
case VideoColorSpace::TransferID::LINEAR:
case VideoColorSpace::TransferID::LOG:
case VideoColorSpace::TransferID::LOG_SQRT:
case VideoColorSpace::TransferID::BT1361_ECG:
case VideoColorSpace::TransferID::SMPTEST2084:
case VideoColorSpace::TransferID::IEC61966_2_4:
case VideoColorSpace::TransferID::SMPTEST428_1:
case VideoColorSpace::TransferID::ARIB_STD_B67:
break;
// Never supported.
case VideoColorSpace::TransferID::INVALID:
return false;
}
switch (color_space.matrix) {
// Supported before color management.
case VideoColorSpace::MatrixID::BT709:
case VideoColorSpace::MatrixID::UNSPECIFIED:
case VideoColorSpace::MatrixID::BT470BG:
case VideoColorSpace::MatrixID::SMPTE170M:
case VideoColorSpace::MatrixID::BT2020_NCL:
break;
// Supported with color management.
case VideoColorSpace::MatrixID::RGB:
case VideoColorSpace::MatrixID::FCC:
case VideoColorSpace::MatrixID::SMPTE240M:
case VideoColorSpace::MatrixID::YCOCG:
case VideoColorSpace::MatrixID::YDZDX:
case VideoColorSpace::MatrixID::BT2020_CL:
break;
// Never supported.
case VideoColorSpace::MatrixID::INVALID:
return false;
}
if (color_space.range == gfx::ColorSpace::RangeID::INVALID)
return false;
return true;
}
#if !BUILDFLAG(USE_PROPRIETARY_CODECS)
bool IsVideoCodecProprietary(VideoCodec codec) {
switch (codec) {
case VideoCodec::kVC1:
case VideoCodec::kH264:
case VideoCodec::kMPEG2:
case VideoCodec::kMPEG4:
case VideoCodec::kHEVC:
case VideoCodec::kDolbyVision:
return true;
case VideoCodec::kUnknown:
case VideoCodec::kTheora:
case VideoCodec::kVP8:
case VideoCodec::kVP9:
case VideoCodec::kAV1:
return false;
}
}
bool IsAudioCodecProprietary(AudioCodec codec) {
switch (codec) {
case AudioCodec::kAAC:
case AudioCodec::kAC3:
case AudioCodec::kEAC3:
case AudioCodec::kAMR_NB:
case AudioCodec::kAMR_WB:
case AudioCodec::kGSM_MS:
case AudioCodec::kALAC:
case AudioCodec::kMpegHAudio:
case AudioCodec::kDTS:
case AudioCodec::kDTSXP2:
case AudioCodec::kDTSE:
case AudioCodec::kAC4:
return true;
case AudioCodec::kFLAC:
case AudioCodec::kIAMF:
case AudioCodec::kMP3:
case AudioCodec::kOpus:
case AudioCodec::kVorbis:
case AudioCodec::kPCM:
case AudioCodec::kPCM_MULAW:
case AudioCodec::kPCM_S16BE:
case AudioCodec::kPCM_S24BE:
case AudioCodec::kPCM_ALAW:
case AudioCodec::kUnknown:
return false;
}
}
#endif // !BUILDFLAG(USE_PROPRIETARY_CODECS)
bool IsHevcProfileSupported(const VideoType& type) {
return true;
}
bool IsVp9ProfileSupported(const VideoType& type) {
#if BUILDFLAG(ENABLE_LIBVPX)
// High bit depth capabilities may be toggled via LibVPX config flags.
static const bool vpx_supports_hbd = (vpx_codec_get_caps(vpx_codec_vp9_dx()) &
VPX_CODEC_CAP_HIGHBITDEPTH) != 0;
// Color management required for HDR to not look terrible.
if (!IsColorSpaceSupported(type.color_space))
return false;
switch (type.profile) {
// LibVPX always supports Profiles 0 and 1.
case VP9PROFILE_PROFILE0:
case VP9PROFILE_PROFILE1:
return true;
#if BUILDFLAG(IS_ANDROID)
case VP9PROFILE_PROFILE2:
return vpx_supports_hbd ||
MediaCodecUtil::IsVp9Profile2DecoderAvailable();
case VP9PROFILE_PROFILE3:
return vpx_supports_hbd ||
MediaCodecUtil::IsVp9Profile3DecoderAvailable();
#else
case VP9PROFILE_PROFILE2:
case VP9PROFILE_PROFILE3:
return vpx_supports_hbd;
#endif // BUILDFLAG(IS_ANDROID)
default:
NOTREACHED();
}
#endif // BUILDFLAG(ENABLE_LIBVPX)
return false;
}
bool IsAV1Supported(const VideoType& type) {
// If the AV1 decoder is enabled, or if we're on Q or later, yes.
#if BUILDFLAG(ENABLE_AV1_DECODER)
return IsColorSpaceSupported(type.color_space);
#elif BUILDFLAG(IS_ANDROID)
return base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_Q &&
IsColorSpaceSupported(type.color_space);
#else
return false;
#endif
}
bool IsMPEG4Supported() {
#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_PROPRIETARY_CODECS)
return base::FeatureList::IsEnabled(kCrOSLegacyMediaFormats);
#else
return false;
#endif
}
bool IsAACSupported(const AudioType& type) {
if (type.profile != AudioCodecProfile::kXHE_AAC)
return true;
#if BUILDFLAG(IS_ANDROID)
return base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_P;
#elif BUILDFLAG(IS_MAC)
return true;
#elif BUILDFLAG(IS_WIN)
return base::win::GetVersion() >= base::win::Version::WIN11_22H2 &&
!base::win::OSInfo::GetInstance()->IsWindowsNSku();
#else
return false;
#endif
}
bool IsDolbyVisionProfileSupported(const VideoType& type) {
#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && \
BUILDFLAG(PLATFORM_HAS_OPTIONAL_HEVC_SUPPORT) && \
BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
return GetSupplementalProfileCache()->IsProfileSupported(type.profile);
#else
return false;
#endif
}
} // namespace
bool IsSupportedAudioType(const AudioType& type) {
if (auto* media_client = GetMediaClient())
return media_client->IsSupportedAudioType(type);
return IsDefaultSupportedAudioType(type);
}
bool IsSupportedVideoType(const VideoType& type) {
if (auto* media_client = GetMediaClient())
return media_client->IsSupportedVideoType(type);
return IsDefaultSupportedVideoType(type);
}
// TODO(chcunningham): Add platform specific logic for Android (move from
// MimeUtilInternal).
bool IsDefaultSupportedVideoType(const VideoType& type) {
if (!IsSupportedHdrMetadata(type)) {
return false;
}
#if !BUILDFLAG(USE_PROPRIETARY_CODECS)
if (IsVideoCodecProprietary(type.codec))
return false;
#endif
switch (type.codec) {
case VideoCodec::kTheora:
return IsBuiltInVideoCodec(type.codec);
case VideoCodec::kH264:
return true;
case VideoCodec::kVP8:
return IsBuiltInVideoCodec(type.codec)
? true
: GetSupplementalProfileCache()->IsProfileSupported(
type.profile);
case VideoCodec::kAV1:
return IsAV1Supported(type);
case VideoCodec::kVP9:
return IsVp9ProfileSupported(type);
case VideoCodec::kHEVC:
return IsHevcProfileSupported(type);
case VideoCodec::kMPEG4:
return IsMPEG4Supported();
case VideoCodec::kDolbyVision:
return IsDolbyVisionProfileSupported(type);
case VideoCodec::kUnknown:
case VideoCodec::kVC1:
case VideoCodec::kMPEG2:
return false;
}
}
bool IsDefaultSupportedAudioType(const AudioType& type) {
if (type.spatial_rendering)
return false;
#if !BUILDFLAG(USE_PROPRIETARY_CODECS)
if (IsAudioCodecProprietary(type.codec))
return false;
#endif
switch (type.codec) {
case AudioCodec::kAAC:
return IsAACSupported(type);
case AudioCodec::kFLAC:
case AudioCodec::kMP3:
case AudioCodec::kOpus:
case AudioCodec::kPCM:
case AudioCodec::kPCM_MULAW:
case AudioCodec::kPCM_S16BE:
case AudioCodec::kPCM_S24BE:
case AudioCodec::kPCM_ALAW:
case AudioCodec::kVorbis:
return true;
case AudioCodec::kAMR_NB:
case AudioCodec::kAMR_WB:
case AudioCodec::kGSM_MS:
case AudioCodec::kALAC:
case AudioCodec::kMpegHAudio:
case AudioCodec::kIAMF:
case AudioCodec::kUnknown:
return false;
case AudioCodec::kDTS:
case AudioCodec::kDTSXP2:
case AudioCodec::kDTSE:
return BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO);
case AudioCodec::kAC3:
case AudioCodec::kEAC3:
return BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO);
case AudioCodec::kAC4:
return BUILDFLAG(ENABLE_PLATFORM_AC4_AUDIO);
}
}
bool IsBuiltInVideoCodec(VideoCodec codec) {
#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) && BUILDFLAG(USE_PROPRIETARY_CODECS)
if (codec == VideoCodec::kH264 || codec == VideoCodec::kHEVC) {
return true;
}
#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) &&
// BUILDFLAG(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(ENABLE_LIBVPX)
if (codec == VideoCodec::kVP8 || codec == VideoCodec::kVP9) {
return true;
}
#endif // BUILDFLAG(ENABLE_LIBVPX)
#if BUILDFLAG(ENABLE_AV1_DECODER)
if (codec == VideoCodec::kAV1)
return true;
#endif // BUILDFLAG(ENABLE_AV1_DECODER)
return false;
}
void UpdateDefaultSupportedVideoProfiles(
const base::flat_set<media::VideoCodecProfile>& profiles) {
GetSupplementalProfileCache()->UpdateCache(profiles);
}
void UpdateDefaultSupportedAudioTypes(const base::flat_set<AudioType>& types) {
GetSupplementalAudioTypeCache()->UpdateCache(types);
}
} // namespace media

View file

@ -95,8 +95,8 @@ config("compiler") {
}
if (current_cpu == "x86" || current_cpu == "x64") {
cflags += [ "-msse3" ]
ldflags += [ "-msse3" ]
cflags += [ "-msse3", "-mssse3", "-msse4.1" ]
ldflags += [ "-msse3", "-mssse3", "-msse4.1" ]
}
# Assign any flags set for the C compiler to asmflags so that they are sent

View file

@ -14,7 +14,6 @@ import("//chrome/android/chrome_java_resources.gni")
import("//chrome/android/chrome_public_apk_tmpl.gni")
import("//chrome/android/expectations/expectations.gni")
import("//chrome/android/features/dev_ui/dev_ui_module.gni")
import("//chrome/android/features/start_surface/start_surface_java_sources.gni")
import("//chrome/android/features/tab_ui/tab_management_java_sources.gni")
import("//chrome/android/feed/feed_java_sources.gni")
import("//chrome/android/modules/chrome_bundle_tmpl.gni")
@ -167,6 +166,8 @@ if (current_toolchain == default_toolchain) {
"java/res_base/font/chrome_google_sans.xml",
"java/res_base/font/chrome_google_sans_bold.xml",
"java/res_base/font/chrome_google_sans_medium.xml",
"java/res_base/font/chrome_google_sans_text.xml",
"java/res_base/font/chrome_google_sans_text_medium.xml",
"java/res_base/values/ic_launcher_alias.xml",
"java/res_base/values/ic_launcher_round_alias.xml",
"java/res_base/values/values.xml",
@ -198,6 +199,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/android/customtabs/branding:java_resources",
"//chrome/browser/autofill/android:java_resources",
"//chrome/browser/commerce/price_change/android:java_resources",
"//chrome/browser/commerce/price_insights/android:java_resources",
"//chrome/browser/download/android:java_resources",
"//chrome/browser/feed/android:feed_java_resources",
"//chrome/browser/feedback/android:java_resources",
@ -219,6 +221,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/device_lock:java_resources",
"//chrome/browser/ui/android/favicon:java_resources",
"//chrome/browser/ui/android/google_bottom_bar:java_resources",
"//chrome/browser/ui/android/logo:java_resources",
"//chrome/browser/ui/android/management:java_resources",
"//chrome/browser/ui/android/omnibox:java_resources",
"//chrome/browser/ui/android/quickactionsearchwidget:java_resources",
@ -241,6 +244,7 @@ if (current_toolchain == default_toolchain) {
"//components/browser_ui/theme/android:java_resources",
"//components/browser_ui/util/android:java_resources",
"//components/browser_ui/widget/android:java_resources",
"//components/embedder_support/android:web_contents_delegate_java_resources",
"//components/find_in_page/android:java_resources",
"//components/javascript_dialogs/android:java_resources",
"//components/media_router/browser/android:java_resources",
@ -270,6 +274,13 @@ if (current_toolchain == default_toolchain) {
}
}
android_resources("java_overlay_resources") {
# Target for overrides of //ui/android:ui_java_resources
resource_overlay = true
sources = [ "java/res_overlay/values-v33/styles.xml" ]
deps = [ "//ui/android:ui_java_resources" ]
}
android_library("app_hooks_java") {
sources = [ app_hooks_impl ]
deps = [ ":chrome_java" ]
@ -305,6 +316,10 @@ if (current_toolchain == default_toolchain) {
"//components/sync/android:explicit_passphrase_platform_client_stub_java",
"//content/public/android:identity_credentials_public_impl_java",
]
if (defined(enable_tinker_tank_internal) && enable_tinker_tank_internal) {
deps +=
[ "//chrome/browser/android/tinker_tank:delegate_public_impl_java" ]
}
}
android_library("google_api_keys_java") {
@ -317,6 +332,7 @@ if (current_toolchain == default_toolchain) {
":chrome_app_java_resources",
":chrome_public_apk_template_resources",
":google_api_keys_java",
":java_overlay_resources",
":usage_stats_proto_java",
"$google_play_services_package:google_play_services_auth_base_java",
"$google_play_services_package:google_play_services_base_java",
@ -333,9 +349,7 @@ if (current_toolchain == default_toolchain) {
"//cc/mojom:mojom_java",
"//chrome/android/features/jank_tracker:jank_tracker_java",
"//chrome/android/features/keyboard_accessory:public_java",
"//chrome/android/features/start_surface:java_resources",
"//chrome/android/features/start_surface:public_java",
"//chrome/android/features/tab_ui:tab_suggestions_java",
"//chrome/android/features/tab_ui:java_resources",
"//chrome/android/features/tab_ui/public:java",
"//chrome/android/features/tab_ui/public:ui_java_resources",
"//chrome/android/modules/cablev2_authenticator/public:java",
@ -357,6 +371,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/android/lifecycle:java",
"//chrome/browser/android/messages:java",
"//chrome/browser/android/metrics:java",
"//chrome/browser/android/tinker_tank:delegate_java",
"//chrome/browser/autofill/android:java",
"//chrome/browser/auxiliary_search:java",
"//chrome/browser/back_press/android:java",
@ -367,6 +382,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/commerce/android:java",
"//chrome/browser/commerce/merchant_viewer/android:java",
"//chrome/browser/commerce/price_change/android:java",
"//chrome/browser/commerce/price_insights/android:java",
"//chrome/browser/commerce/price_tracking/android:java",
"//chrome/browser/commerce/price_tracking/proto:proto_java",
"//chrome/browser/commerce/subscriptions/android:subscriptions_java",
@ -375,7 +391,9 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/contextmenu:java",
"//chrome/browser/creator/android:java",
"//chrome/browser/data_sharing:factory_java",
"//chrome/browser/data_sharing:invitation_dialog_java",
"//chrome/browser/data_sharing:java",
"//chrome/browser/data_sharing:shared_image_tiles_java",
"//chrome/browser/dependency_injection:java",
"//chrome/browser/device:java",
"//chrome/browser/device_reauth/android:java",
@ -418,6 +436,8 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/password_entry_edit:public_java",
"//chrome/browser/password_manager/android:java",
"//chrome/browser/password_manager/android:settings_interface_java",
"//chrome/browser/password_manager/android/account_storage_toggle:java",
"//chrome/browser/password_manager/android/bottom_sheet:java",
"//chrome/browser/password_manager/android/pwd_migration:java",
"//chrome/browser/password_manager/android/pwd_migration:java_resources",
"//chrome/browser/policy/android:java",
@ -442,6 +462,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/search_resumption:java",
"//chrome/browser/segmentation_platform:factory_java",
"//chrome/browser/selection/android:java",
"//chrome/browser/settings:factory_java",
"//chrome/browser/settings:java",
"//chrome/browser/share:java",
"//chrome/browser/share/android:java_resources",
@ -489,7 +510,9 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/page_insights:java",
"//chrome/browser/ui/android/page_insights:proto_java",
"//chrome/browser/ui/android/pdf:java",
"//chrome/browser/ui/android/pdf:pdf_provider_java",
"//chrome/browser/ui/android/plus_addresses:java",
"//chrome/browser/ui/android/preloading:java",
"//chrome/browser/ui/android/quickactionsearchwidget:java",
"//chrome/browser/ui/android/searchactivityutils:java",
"//chrome/browser/ui/android/signin:java",
@ -505,6 +528,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/wallet/android:java",
"//chrome/browser/webapps/android:java",
"//chrome/browser/webauthn/android:java",
"//chrome/browser/webid:java",
"//chrome/browser/xsurface:java",
"//chrome/browser/xsurface_provider:dependency_provider_impl_java",
"//chrome/browser/xsurface_provider:java",
@ -582,6 +606,7 @@ if (current_toolchain == default_toolchain) {
"//components/infobars/android:java",
"//components/infobars/core:infobar_enums_java",
"//components/installedapp/android:java",
"//components/ip_protection/android_auth_client_lib/client:ip_protection_auth_client_java",
"//components/javascript_dialogs/android:java",
"//components/language/android:java",
"//components/location/android:location_java",
@ -657,6 +682,7 @@ if (current_toolchain == default_toolchain) {
"//components/webxr/android:xr_java",
"//components/zoom/android:java",
"//content/public/android:content_java",
"//content/public/android:identity_credentials_java",
"//content/public/common:common_java",
"//device/gamepad:java",
"//media/base/android:media_java",
@ -742,7 +768,6 @@ if (current_toolchain == default_toolchain) {
"//components/ntp_tiles:ntp_tiles_enums_java",
"//components/offline_pages/core:offline_page_model_enums_java",
"//components/supervised_user/core/browser:supervised_user_utils_enum_javagen",
"//net:effective_connection_type_java",
]
# From java_sources.gni.
@ -758,9 +783,6 @@ if (current_toolchain == default_toolchain) {
# TODO(crbug.com/40259582): Make tab_ui/ a module so that these sources can be included in "chrome_all_java".
sources += internal_tab_management_java_sources
# Include sources for start_surface_java_sources.gni
sources += start_surface_java_sources
srcjar_deps += [ ":chrome_jni_headers" ]
# Add the actual implementation where necessary so that downstream targets
@ -780,15 +802,6 @@ if (current_toolchain == default_toolchain) {
processor_args_javac = [ "dagger.fastInit=enabled" ]
if (!is_java_debug) {
if (!defined(proguard_configs)) {
proguard_configs = []
}
proguard_enabled = true
proguard_configs +=
[ "//chrome/android/features/start_surface/proguard.flags" ]
}
resources_package = "org.chromium.chrome"
# TODO(crbug.com/40106499): Instead of adding source files, add it as a separate
@ -864,6 +877,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/password_entry_edit/android/internal:java",
"//chrome/browser/password_manager/android/add_username_dialog:java",
"//chrome/browser/recent_tabs/internal:java",
"//chrome/browser/settings:internal_java",
"//chrome/browser/tabmodel/internal:java",
"//chrome/browser/touch_to_fill/autofill/android/internal:java",
"//chrome/browser/touch_to_fill/common/android:java",
@ -979,9 +993,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/android:usage_stats_proto_java",
"//chrome/android/features/android_library_factory:junit_tests",
"//chrome/android/features/keyboard_accessory:internal_java",
"//chrome/android/features/start_surface:java_resources",
"//chrome/android/features/start_surface:public_java",
"//chrome/android/features/tab_ui:tab_suggestions_java",
"//chrome/android/features/keyboard_accessory/public:public_java",
"//chrome/android/features/tab_ui/public:java",
"//chrome/android/webapk/libs/client:client_java",
"//chrome/android/webapk/libs/common:common_java",
@ -1011,6 +1023,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/commerce/android:java",
"//chrome/browser/commerce/merchant_viewer/android:junit",
"//chrome/browser/commerce/price_change/android:junit",
"//chrome/browser/commerce/price_insights/android:junit",
"//chrome/browser/commerce/price_tracking/android:java",
"//chrome/browser/commerce/price_tracking/proto:proto_java",
"//chrome/browser/commerce/subscriptions/android:subscriptions_java",
@ -1020,6 +1033,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/creator/android:junit",
"//chrome/browser/data_sharing:java",
"//chrome/browser/data_sharing:junit",
"//chrome/browser/data_sharing:shared_image_tiles_java",
"//chrome/browser/dependency_injection:java",
"//chrome/browser/device:java",
"//chrome/browser/device:junit",
@ -1064,6 +1078,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/omaha/android:java",
"//chrome/browser/omaha/android:update_proto_java",
"//chrome/browser/optimization_guide/android:java",
"//chrome/browser/page_image_service/android:java",
"//chrome/browser/page_image_service/android:junit",
"//chrome/browser/page_load_metrics:java",
"//chrome/browser/partnercustomizations:java",
@ -1142,7 +1157,9 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/edge_to_edge/internal:junit",
"//chrome/browser/ui/android/fast_checkout/internal:junit",
"//chrome/browser/ui/android/favicon:java",
"//chrome/browser/ui/android/google_bottom_bar:java",
"//chrome/browser/ui/android/google_bottom_bar:junit",
"//chrome/browser/ui/android/google_bottom_bar:proto_java",
"//chrome/browser/ui/android/hats:factory_java",
"//chrome/browser/ui/android/hats:junit",
"//chrome/browser/ui/android/hats/internal:junit",
@ -1168,12 +1185,14 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/pdf:java",
"//chrome/browser/ui/android/pdf:junit",
"//chrome/browser/ui/android/plus_addresses:junit",
"//chrome/browser/ui/android/preloading:java",
"//chrome/browser/ui/android/quickactionsearchwidget:java",
"//chrome/browser/ui/android/searchactivityutils:java",
"//chrome/browser/ui/android/searchactivityutils:junit",
"//chrome/browser/ui/android/signin:java",
"//chrome/browser/ui/android/signin:junit",
"//chrome/browser/ui/android/theme:java",
"//chrome/browser/ui/android/theme:junit",
"//chrome/browser/ui/android/toolbar:java",
"//chrome/browser/ui/android/toolbar:junit",
"//chrome/browser/ui/android/webid/internal:junit",
@ -1190,6 +1209,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/wallet/android:junit",
"//chrome/browser/webapps/android:java",
"//chrome/browser/webauthn/android:java",
"//chrome/browser/webid:junit",
"//chrome/browser/xsurface:java",
"//chrome/browser/xsurface_provider:junit",
"//chrome/test:sync_integration_test_support_java",
@ -1293,6 +1313,8 @@ if (current_toolchain == default_toolchain) {
"//components/webapps/browser/android:java",
"//components/webapps/browser/android:webapps_jni_headers_java",
"//content/public/android:content_java",
"//content/public/android:content_main_dex_jni_java",
"//content/public/android:public_common_jni_java",
"//content/public/common:common_java",
"//content/public/test/android:content_java_test_support",
"//mojo/public/java:bindings_java",
@ -1416,11 +1438,13 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/android/browserservices/intents:java",
"//chrome/browser/android/intents:java",
"//chrome/browser/autofill/android:java",
"//chrome/browser/feature_engagement:java",
"//chrome/browser/flags:java",
"//chrome/browser/profiles/android:java",
"//chrome/browser/tab:java",
"//chrome/browser/ui/android/appmenu:java",
"//chrome/test/android:chrome_java_integration_test_support",
"//components/feature_engagement/public:public_java",
"//components/payments/content/android:java",
"//components/payments/content/android:java_resources",
"//components/payments/content/android:payments_java_test_support",
@ -1439,6 +1463,7 @@ if (current_toolchain == default_toolchain) {
"//third_party/hamcrest:hamcrest_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit:junit",
"//third_party/mockito:mockito_java",
"//ui/android:ui_no_recycler_view_java",
"//url:gurl_java",
]
@ -1648,10 +1673,7 @@ if (current_toolchain == default_toolchain) {
"//cc:cc_java",
"//chrome/android:chrome_java",
"//chrome/android/features/keyboard_accessory/public:public_java",
"//chrome/android/features/start_surface:java_resources",
"//chrome/android/features/start_surface:public_java",
"//chrome/android/features/tab_ui:java_resources",
"//chrome/android/features/tab_ui:tab_suggestions_java",
"//chrome/android/features/tab_ui:test_support_javalib",
"//chrome/android/features/tab_ui/public:java",
"//chrome/android/webapk/libs/client:client_java",
@ -1679,6 +1701,8 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/commerce/android:javatests",
"//chrome/browser/commerce/merchant_viewer/android:java",
"//chrome/browser/commerce/merchant_viewer/android:javatests",
"//chrome/browser/commerce/price_insights/android:java",
"//chrome/browser/commerce/price_insights/android:javatests",
"//chrome/browser/commerce/price_tracking/android:java",
"//chrome/browser/commerce/subscriptions/android:subscriptions_java",
"//chrome/browser/contextmenu:java",
@ -1726,6 +1750,8 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/password_manager/android:java",
"//chrome/browser/password_manager/android:settings_interface_java",
"//chrome/browser/password_manager/android:test_support_java",
"//chrome/browser/password_manager/android/account_storage_toggle:java",
"//chrome/browser/password_manager/android/pwd_check_wrapper:test_support_java",
"//chrome/browser/password_manager/android/pwd_migration:java",
"//chrome/browser/policy/android:java",
"//chrome/browser/preferences:java",
@ -1739,11 +1765,13 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/profiles/android:java",
"//chrome/browser/quick_delete:java",
"//chrome/browser/quick_delete:javatests",
"//chrome/browser/readaloud/android:java",
"//chrome/browser/safe_browsing/android:java",
"//chrome/browser/safe_browsing/android:javatests",
"//chrome/browser/safety_check/android:java",
"//chrome/browser/safety_check/android:javatests",
"//chrome/browser/safety_hub/android:java",
"//chrome/browser/safety_hub/android:javatests",
"//chrome/browser/screenshot_monitor:java",
"//chrome/browser/search_engines/android:java",
"//chrome/browser/segmentation_platform:javatests",
@ -1793,6 +1821,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/night_mode:night_mode_java_test_support",
"//chrome/browser/ui/android/omnibox:java",
"//chrome/browser/ui/android/page_info:java",
"//chrome/browser/ui/android/pdf:java",
"//chrome/browser/ui/android/quickactionsearchwidget:java",
"//chrome/browser/ui/android/quickactionsearchwidget:javatests",
"//chrome/browser/ui/android/searchactivityutils:java",
@ -1897,6 +1926,7 @@ if (current_toolchain == default_toolchain) {
"//components/omnibox/common:features_java",
"//components/optimization_guide/proto:optimization_guide_proto_java",
"//components/page_info/android:java",
"//components/page_info/android:javatests",
"//components/page_info/android:page_info_action_enum_java",
"//components/page_info/core:proto_java",
"//components/paint_preview/player/android:java",
@ -1995,6 +2025,7 @@ if (current_toolchain == default_toolchain) {
"//third_party/mockito:mockito_java",
"//ui/accessibility:ax_base_java",
"//ui/android:clipboard_java_test_support",
"//ui/android:ui_android_features_java",
"//ui/android:ui_java",
"//ui/android:ui_java_test_support",
"//ui/base/ime/mojom:mojom_java",
@ -2031,7 +2062,6 @@ if (current_toolchain == default_toolchain) {
"//chrome/test/data/offline_pages/",
"//chrome/test/data/password/",
"//chrome/test/data/popup_blocker/",
"//chrome/test/data/portal/",
"//chrome/test/data/push_messaging/",
"//chrome/test/data/translate/",
"//chrome/test/data/webauthn/",
@ -2561,6 +2591,7 @@ if (current_toolchain == default_toolchain) {
":test_support_jni_headers",
"//chrome/browser",
"//chrome/browser:browser_process",
"//chrome/browser/sync",
"//chrome/browser/thumbnail:test_support",
"//components/offline_pages/core/background:test_support",
"//components/query_tiles",
@ -2663,6 +2694,7 @@ if (current_toolchain == default_toolchain) {
"java/src/org/chromium/chrome/browser/media/ui/ChromeMediaNotificationControllerServices.java",
"java/src/org/chromium/chrome/browser/metrics/SimpleStartupForegroundSessionDetector.java",
"java/src/org/chromium/chrome/browser/metrics/UmaUtils.java",
"java/src/org/chromium/chrome/browser/notifications/NotificationIntentInterceptorService.java",
"java/src/org/chromium/chrome/browser/notifications/NotificationJobService.java",
"java/src/org/chromium/chrome/browser/notifications/NotificationService.java",
"java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java",
@ -2682,6 +2714,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/flags:java",
"//chrome/browser/language/android:base_module_java",
"//chrome/browser/preferences:java",
"//chrome/browser/ui/android/pdf:pdf_provider_java",
"//chrome/browser/util:java",
"//chrome/browser/version:java",
"//components/crash/android:java",
@ -2848,7 +2881,7 @@ if (current_toolchain == default_toolchain) {
# scoped, and do not leave lingering state after execution.
# TODO(crbug.com/40193330): Set clear rules for what tests can be added here.
chrome_public_test_apk_tmpl("chrome_public_unit_test_apk") {
apk_name = "ChromePublicUnitTest"
apk_name = "ThoriumPublicTest"
deps = [
":chrome_unit_test_java",
"//build/config/android/test/resource_overlay:unit_device_javatests",
@ -2932,10 +2965,11 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/banners/android:javatests",
"//chrome/browser/download/internal/android:javatests",
"//chrome/browser/engagement/android:javatests",
"//chrome/browser/facilitated_payments/ui/android/internal:javatests",
"//chrome/browser/flags:javatests",
"//chrome/browser/gesturenav/android:javatests",
"//chrome/browser/password_check/android:test_java",
"//chrome/browser/password_manager/android/pwd_migration:javatests",
"//chrome/browser/password_manager/android:javatests",
"//chrome/browser/recent_tabs/internal:recent_tabs_javatests",
"//chrome/browser/subresource_filter:subresource_filter_javatests",
"//chrome/browser/touch_to_fill/autofill/android/internal:javatests",
@ -2943,7 +2977,9 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android:javatests",
"//chrome/browser/touch_to_fill/password_manager/password_generation/android/internal:javatests",
"//chrome/browser/ui/android/fast_checkout/internal:javatests",
"//chrome/browser/ui/android/plus_addresses:javatests",
"//chrome/browser/ui/android/webid/internal:javatests",
"//components/ip_protection/android_auth_client_lib/javatests:ip_protection_auth_javatests",
]
data_deps = [ "//testing/buildbot/filters:chrome_public_test_apk_filters" ]
@ -2956,6 +2992,7 @@ if (current_toolchain == default_toolchain) {
additional_apks = [
"//chrome/android/webapk/shell_apk:javatests_webapk",
"//chrome/test/android/chrome_public_test_support:chrome_public_test_support_apk",
"//components/ip_protection/android_auth_client_lib/testing/mock_service:ip_protection_auth_test_service_apk",
"//components/media_router/test/android/media_router_test_support:media_router_test_support_apk",
]
@ -3326,37 +3363,6 @@ if (current_toolchain == default_toolchain) {
}
}
if (is_official_build) {
# Used for binary size monitoring.
create_app_bundle_minimal_apks("monochrome_public_minimal_apks") {
deps = [ ":$_main_monochrome_public_bundle_target" ]
bundle_path = "$root_build_dir/apks/MonochromePublic.aab"
}
_monochrome_minimal_apks_filename = "MonochromePublic.minimal.apks"
android_resource_sizes_test(
"resource_sizes_monochrome_public_minimal_apks") {
file_path = "$root_build_dir/apks/${_monochrome_minimal_apks_filename}"
data_deps = [ ":monochrome_public_minimal_apks" ]
}
if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
# Used for binary size monitoring.
create_app_bundle_minimal_apks("monochrome_32_public_minimal_apks") {
deps = [ ":monochrome_32_public_bundle" ]
bundle_path = "$root_build_dir/apks/MonochromePublic32.aab"
}
_monochrome_32_minimal_apks_filename = "MonochromePublic32.minimal.apks"
android_resource_sizes_test(
"resource_sizes_monochrome_32_public_minimal_apks") {
file_path =
"$root_build_dir/apks/${_monochrome_32_minimal_apks_filename}"
data_deps = [ ":monochrome_32_public_minimal_apks" ]
}
}
}
chrome_public_bundle(_main_trichrome_chrome_bundle_target) {
is_trichrome = true
bundle_name = "TrichromeChrome"
@ -3393,7 +3399,8 @@ if (current_toolchain == default_toolchain) {
fuse_apk = true
}
if (is_official_build) {
# Used for binary size monitoring things:
if (is_official_build && !skip_secondary_abi_for_cq) {
_trichrome_library_basename = "TrichromeLibrary.apk"
_trichrome_chrome_basename = "TrichromeChrome.minimal.apks"
_trichrome_webview_basename = "TrichromeWebView.minimal.apks"
@ -3407,7 +3414,28 @@ if (current_toolchain == default_toolchain) {
trichrome_webview_basename = _trichrome_webview_basename
}
if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
if (android_64bit_target_cpu) {
# Measure _64 rather than _64_32 in order to save on compile time.
# The secondary ABI can be measured via trichrome_32_minimal_apks.
write_ssargs_trichrome("ssargs_trichrome_64") {
ssargs_path = "$root_build_dir/apks/Trichrome64.ssargs"
abi_filter = android_app_abi
trichrome_library_basename = "TrichromeLibrary64.apk"
trichrome_chrome_basename = "TrichromeChrome64.minimal.apks"
trichrome_webview_basename = "TrichromeWebView64.minimal.apks"
}
create_app_bundle_minimal_apks("trichrome_chrome_64_minimal_apks") {
deps = [ ":trichrome_chrome_64_bundle" ]
bundle_path = "$root_build_dir/apks/TrichromeChrome64.aab"
}
group("trichrome_64_minimal_apks") {
deps = [
":trichrome_chrome_64_minimal_apks",
":trichrome_library_64_apk",
"//android_webview:trichrome_webview_64_minimal_apks",
]
}
_trichrome_library_32_basename = "TrichromeLibrary32.apk"
_trichrome_chrome_32_basename = "TrichromeChrome32.minimal.apks"
_trichrome_webview_32_basename = "TrichromeWebView32.minimal.apks"
@ -3422,7 +3450,6 @@ if (current_toolchain == default_toolchain) {
trichrome_webview_basename = _trichrome_webview_32_basename
}
# Used for binary size monitoring.
create_app_bundle_minimal_apks("trichrome_chrome_32_minimal_apks") {
deps = [ ":trichrome_chrome_32_bundle" ]
bundle_path = "$root_build_dir/apks/TrichromeChrome32.aab"
@ -3440,7 +3467,6 @@ if (current_toolchain == default_toolchain) {
_symbol_dir_for_size = "android_clang_arm/lib.unstripped"
_ssargs_filename_for_size = _ssargs_32_filename
} else {
# Used for binary size monitoring.
create_app_bundle_minimal_apks("trichrome_chrome_minimal_apks") {
deps = [ ":$_main_trichrome_chrome_bundle_target" ]
bundle_path = "$root_build_dir/apks/TrichromeChrome.aab"
@ -3632,7 +3658,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/app/tab_activity_glue/ReparentingTask.java",
"java/src/org/chromium/chrome/browser/autofill/AutofillAccessibilityUtils.java",
"java/src/org/chromium/chrome/browser/autofill/AutofillExpirationDateFixFlowBridge.java",
"java/src/org/chromium/chrome/browser/autofill/AutofillLogger.java",
"java/src/org/chromium/chrome/browser/autofill/AutofillNameFixFlowBridge.java",
"java/src/org/chromium/chrome/browser/autofill/AutofillSnackbarController.java",
"java/src/org/chromium/chrome/browser/autofill/CardUnmaskBridge.java",
@ -3672,6 +3697,7 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java",
"java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchContext.java",
"java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java",
"java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java",
"java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTabHelper.java",
"java/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceImpl.java",
"java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java",
@ -3697,12 +3723,10 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/feedback/ScreenshotTask.java",
"java/src/org/chromium/chrome/browser/firstrun/FirstRunUtils.java",
"java/src/org/chromium/chrome/browser/flags/BadFlagsSnackbarManager.java",
"java/src/org/chromium/chrome/browser/gesturenav/OverscrollSceneLayer.java",
"java/src/org/chromium/chrome/browser/history/BrowsingHistoryBridge.java",
"java/src/org/chromium/chrome/browser/history/HistoryDeletionBridge.java",
"java/src/org/chromium/chrome/browser/history/HistoryDeletionInfo.java",
"java/src/org/chromium/chrome/browser/historyreport/HistoryReportJniBridge.java",
"java/src/org/chromium/chrome/browser/infobar/AutofillCreditCardFillingInfoBar.java",
"java/src/org/chromium/chrome/browser/infobar/AutofillSaveCardInfoBar.java",
"java/src/org/chromium/chrome/browser/infobar/AutofillVirtualCardEnrollmentInfoBar.java",
"java/src/org/chromium/chrome/browser/infobar/DuplicateDownloadInfoBar.java",
@ -3725,7 +3749,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/metrics/VariationsSession.java",
"java/src/org/chromium/chrome/browser/mojo/ChromeInterfaceRegistrar.java",
"java/src/org/chromium/chrome/browser/navigation_predictor/NavigationPredictorBridge.java",
"java/src/org/chromium/chrome/browser/net/nqe/NetworkQualityProvider.java",
"java/src/org/chromium/chrome/browser/notifications/ActionInfo.java",
"java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java",
"java/src/org/chromium/chrome/browser/notifications/NotificationSuspender.java",
@ -3752,7 +3775,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/password_manager/Credential.java",
"java/src/org/chromium/chrome/browser/password_manager/CredentialLeakDialogBridge.java",
"java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupLauncher.java",
"java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationDialogBridge.java",
"java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java",
"java/src/org/chromium/chrome/browser/password_manager/PasswordManagerErrorMessageHelperBridge.java",
"java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLauncher.java",
@ -3812,7 +3834,10 @@ generate_jni("chrome_jni_headers") {
sources += [ "java/src/org/chromium/chrome/browser/offlinepages/evaluation/OfflinePageEvaluationBridge.java" ]
}
public_deps = [ ":base_module_jni" ]
public_deps = [
":base_module_jni",
"//chrome/browser/webid:jni_headers",
]
}
source_set("chrome_test_util") {
@ -3838,7 +3863,6 @@ group("jni_headers") {
public_deps = [
":chrome_jni_headers",
"//chrome/android/features/keyboard_accessory:jni_headers",
"//chrome/android/features/start_surface:jni_headers",
"//chrome/browser/android/browserservices/metrics:jni_headers",
"//chrome/browser/android/browserservices/verification:jni_headers",
"//chrome/browser/android/metrics:jni_headers",
@ -3870,6 +3894,7 @@ group("jni_headers") {
"//chrome/browser/tab_ui/android:jni_headers",
"//chrome/browser/touch_to_fill/autofill/android:jni_headers",
"//chrome/browser/touch_to_fill/password_manager/android:jni_headers",
"//chrome/browser/ui/android/edge_to_edge:jni_headers",
"//chrome/browser/ui/android/fast_checkout:jni_headers",
"//chrome/browser/ui/android/favicon:jni_headers",
"//chrome/browser/ui/android/hats:jni_headers",
@ -3877,6 +3902,7 @@ group("jni_headers") {
"//chrome/browser/ui/android/logo:jni_headers",
"//chrome/browser/ui/android/omnibox:jni_headers",
"//chrome/browser/ui/android/plus_addresses:jni_headers",
"//chrome/browser/ui/android/preloading:jni_headers",
"//chrome/browser/ui/android/toolbar:jni_headers",
"//chrome/browser/ui/android/webid:jni_headers",
"//chrome/browser/ui/messages/android:jni_headers",
@ -3945,6 +3971,7 @@ chrome_common_shared_library("libchromefortest") {
"//chrome/browser/supervised_user:test_support",
"//components/crash/android:crash_android",
"//components/external_intents/android:test_support",
"//components/ip_protection/android_auth_client_lib/cpp:ip_protection_auth_test_natives",
"//components/minidump_uploader",
"//components/paint_preview/player/android:test_support",
"//components/sync",
@ -3988,6 +4015,7 @@ template("libmonochrome_apk_or_bundle_tmpl") {
defines = []
if (android_64bit_target_cpu) {
java_targets = [ "//chrome/android:monochrome_64_public_bundle" ]
priority_java_targets = [ "//android_webview:system_webview_64_bundle" ]
} else {
java_targets = [ "//chrome/android:monochrome_public_bundle" ]
}

View file

@ -29,7 +29,7 @@ declare_args() {
chrome_public_manifest_package = "org.chromium.thorium"
if (use_stable_package_name_for_trichrome) {
chrome_public_manifest_package += ".stable"
# CHANGED BY ALEX313031 FOR THORIUM
# Changed by Alex313031 for Thorium
} else if (android_channel != "default" && android_channel != "stable") {
chrome_public_manifest_package += "." + android_channel
}

View file

@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <string_view>
#include <utility>
#include <vector>
@ -15,6 +16,7 @@
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
@ -159,14 +161,14 @@ ResourceRequestsAllowedState ResourceRequestStateToHistogramValue(
case ResourceRequestAllowedNotifier::ALLOWED:
return RESOURCE_REQUESTS_ALLOWED;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return RESOURCE_REQUESTS_NOT_ALLOWED;
}
// Returns the header value for |name| from |headers| or an empty string if not
// set.
std::string GetHeaderValue(const net::HttpResponseHeaders* headers,
const base::StringPiece& name) {
std::string_view name) {
std::string value;
headers->EnumerateHeader(nullptr, name, &value);
return value;
@ -176,7 +178,7 @@ std::string GetHeaderValue(const net::HttpResponseHeaders* headers,
// set, return an empty list.
std::vector<std::string> GetHeaderValuesList(
const net::HttpResponseHeaders* headers,
const base::StringPiece& name) {
std::string_view name) {
std::vector<std::string> values;
size_t iter = 0;
std::string value;
@ -334,7 +336,9 @@ VariationsService::VariationsService(
local_state_(local_state),
synthetic_trial_registry_(synthetic_trial_registry),
state_manager_(state_manager),
limited_entropy_synthetic_trial_(local_state),
limited_entropy_synthetic_trial_(
local_state,
client_.get()->GetChannelForVariations()),
policy_pref_service_(local_state),
resource_request_allowed_notifier_(std::move(notifier)),
safe_seed_manager_(local_state),
@ -578,15 +582,13 @@ std::unique_ptr<VariationsService> VariationsService::Create(
web_resource::ResourceRequestAllowedNotifier::NetworkConnectionTrackerGetter
network_connection_tracker_getter,
SyntheticTrialRegistry* synthetic_trial_registry) {
std::unique_ptr<VariationsService> result;
result.reset(new VariationsService(
return base::WrapUnique(new VariationsService(
std::move(client),
std::make_unique<web_resource::ResourceRequestAllowedNotifier>(
local_state, disable_network_switch,
std::move(network_connection_tracker_getter)),
local_state, state_manager, ui_string_overrider,
synthetic_trial_registry));
return result;
}
// static

View file

@ -15,7 +15,7 @@
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
#include "ui/display/display_switches.h"
#include "media/mojo/buildflags.h"
#include "ui/gfx/hdr_metadata.h"
#if BUILDFLAG(ENABLE_LIBVPX)
@ -253,7 +253,7 @@ bool IsVp9ProfileSupported(const VideoType& type) {
return vpx_supports_hbd;
#endif // BUILDFLAG(IS_ANDROID)
default:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}
#endif // BUILDFLAG(ENABLE_LIBVPX)
return false;
@ -272,25 +272,13 @@ bool IsAV1Supported(const VideoType& type) {
#endif
}
bool IsMPEG4Supported() {
#if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_PROPRIETARY_CODECS)
return base::FeatureList::IsEnabled(kCrOSLegacyMediaFormats);
#else
return false;
#endif
}
bool IsAACSupported(const AudioType& type) {
if (type.profile != AudioCodecProfile::kXHE_AAC)
if (type.profile != AudioCodecProfile::kXHE_AAC) {
return true;
#if BUILDFLAG(IS_ANDROID)
return base::android::BuildInfo::GetInstance()->sdk_int() >=
base::android::SDK_VERSION_P;
#elif BUILDFLAG(IS_MAC)
return true;
#elif BUILDFLAG(IS_WIN)
return base::win::GetVersion() >= base::win::Version::WIN11_22H2 &&
!base::win::OSInfo::GetInstance()->IsWindowsNSku();
}
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) && \
(BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN))
return GetSupplementalAudioTypeCache()->IsProfileSupported(type);
#else
return false;
#endif
@ -306,6 +294,31 @@ bool IsDolbyVisionProfileSupported(const VideoType& type) {
#endif
}
bool IsDolbyAc3Eac3Supported(const AudioType& type) {
#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) && \
(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC))
return GetSupplementalAudioTypeCache()->IsProfileSupported(type);
#else
// Keep 'true' for other platforms as old code snippet.
return true;
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) && (BUILDFLAG(IS_WIN) ||
// BUILDFLAG(IS_MAC))
#else
return false;
#endif // BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
}
bool IsDolbyAc4Supported(const AudioType& type) {
#if BUILDFLAG(ENABLE_PLATFORM_AC4_AUDIO) && \
BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) && BUILDFLAG(IS_WIN)
return GetSupplementalAudioTypeCache()->IsProfileSupported(type);
#else
return false;
#endif // BUILDFLAG(ENABLE_PLATFORM_AC4_AUDIO) &&
// BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) && BUILDFLAG(IS_WIN)
}
} // namespace
bool IsSupportedAudioType(const AudioType& type) {
@ -348,14 +361,13 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
return IsVp9ProfileSupported(type);
case VideoCodec::kHEVC:
return IsHevcProfileSupported(type);
case VideoCodec::kMPEG2:
return true;
case VideoCodec::kMPEG4:
return IsMPEG4Supported();
case VideoCodec::kDolbyVision:
return IsDolbyVisionProfileSupported(type);
case VideoCodec::kMPEG2:
return true;
case VideoCodec::kUnknown:
case VideoCodec::kVC1:
case VideoCodec::kMPEG4:
return false;
}
}
@ -396,9 +408,9 @@ bool IsDefaultSupportedAudioType(const AudioType& type) {
return BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO);
case AudioCodec::kAC3:
case AudioCodec::kEAC3:
return BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO);
return IsDolbyAc3Eac3Supported(type);
case AudioCodec::kAC4:
return BUILDFLAG(ENABLE_PLATFORM_AC4_AUDIO);
return IsDolbyAc4Supported(type);
}
}

View file

@ -349,7 +349,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
// F.3.1 and F.5.1 in that spec the sample_format for AC3/EAC3 must be 16.
sample_format = kSampleFormatS16;
#else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
#endif
break;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
@ -525,8 +525,11 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->color_range == AVCOL_RANGE_JPEG
? gfx::ColorSpace::RangeID::FULL
: gfx::ColorSpace::RangeID::LIMITED);
VideoPixelFormat pixel_format =
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt);
VideoDecoderConfig::AlphaMode alpha_mode = GetAlphaMode(stream);
VideoChromaSampling chroma_sampling =
VideoPixelFormatToChromaSampling(pixel_format);
switch (codec) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
@ -568,6 +571,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
}
hdr_metadata = hevc_config.GetHDRMetadata();
alpha_mode = hevc_config.GetAlphaMode();
chroma_sampling = hevc_config.GetChromaSampling();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
}
}
@ -659,9 +663,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
}
VideoPixelFormat video_pixel_format =
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt);
if (!color_space.IsSpecified()) {
// VP9 frames may have color information, but that information cannot
// express new color spaces, like HDR. For that reason, color space
@ -681,20 +682,21 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
color_space = (natural_size.height() < 720) ? VideoColorSpace::REC601()
: VideoColorSpace::REC709();
}
} else if (codec_context->codec_id == AV_CODEC_ID_H264 &&
} else if ((codec_context->codec_id == AV_CODEC_ID_HEVC ||
codec_context->codec_id == AV_CODEC_ID_H264) &&
codec_context->colorspace == AVCOL_SPC_RGB &&
VideoPixelFormatToChromaSampling(video_pixel_format) !=
VideoChromaSampling::k444) {
// Some H.264 videos contain a VUI that specifies a color matrix of GBR,
// when they are actually ordinary YUV. Default to BT.709 if the format is
// not 4:4:4 as GBR is reasonable for 4:4:4 content. See crbug.com/1067377
// and crbug.com/341266991.
chroma_sampling != VideoChromaSampling::k444) {
// Some H.264/H.265 videos contain a VUI that specifies a color matrix of
// GBR, when they are actually ordinary YUV. Default to BT.709 if the format
// is not 4:4:4 as GBR is only reasonable for 4:4:4 content. See
// crbug.com/40682932, crbug.com/341266991, crbug.com/342003180, and
// crbug.com/343014700.
color_space = VideoColorSpace::REC709();
} else if (codec_context->codec_id == AV_CODEC_ID_HEVC &&
(color_space.primaries == VideoColorSpace::PrimaryID::INVALID ||
color_space.transfer == VideoColorSpace::TransferID::INVALID ||
color_space.matrix == VideoColorSpace::MatrixID::INVALID) &&
video_pixel_format == PIXEL_FORMAT_I420) {
pixel_format == PIXEL_FORMAT_I420) {
// Some HEVC SDR content encoded by the Adobe Premiere HW HEVC encoder has
// invalid primaries but valid transfer and matrix, and some HEVC SDR
// content encoded by web camera has invalid primaries and transfer, this
@ -924,6 +926,7 @@ VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) {
switch (pixel_format) {
case AV_PIX_FMT_YUV444P:
case AV_PIX_FMT_YUVJ444P:
case AV_PIX_FMT_GBRP:
return PIXEL_FORMAT_I444;
case AV_PIX_FMT_YUV420P:
@ -952,10 +955,13 @@ VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) {
return PIXEL_FORMAT_YUV422P12;
case AV_PIX_FMT_YUV444P9LE:
case AV_PIX_FMT_GBRP9LE:
return PIXEL_FORMAT_YUV444P9;
case AV_PIX_FMT_YUV444P10LE:
case AV_PIX_FMT_GBRP10LE:
return PIXEL_FORMAT_YUV444P10;
case AV_PIX_FMT_YUV444P12LE:
case AV_PIX_FMT_GBRP12LE:
return PIXEL_FORMAT_YUV444P12;
default:

View file

@ -68,17 +68,17 @@ declare_args() {
# Enables AC3/EAC3 audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_ac3_eac3_audio = proprietary_codecs
enable_platform_ac3_eac3_audio = proprietary_codecs && is_cast_media_device
# Enables AC4 audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_ac4_audio = false
enable_platform_mpeg_h_audio = proprietary_codecs
enable_platform_mpeg_h_audio = proprietary_codecs && is_cast_media_device
# Enables DTS/DTSX audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
enable_platform_dts_audio = proprietary_codecs
enable_platform_dts_audio = false
# Enables IAMF audio handling in chromium. This includes demuxing,
# on-device decoding and bitstream passthrough as supported by device.
@ -90,14 +90,15 @@ declare_args() {
#
# TODO(crbug.com/1336055): Revisit the default value for this setting as it
# applies to video-capable devices.
enable_platform_dolby_vision = proprietary_codecs
enable_platform_dolby_vision =
proprietary_codecs && (is_cast_media_device || is_win)
# Enable platform support of encrypted Dolby Vision. The actual support
# depends on platform capability and is controlled by the run time feature
# kPlatformEncryptedDolbyVision. Clear Dolby Vision is not supported by
# default, unless overwritten by the run time feature
# kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled.
enable_platform_encrypted_dolby_vision = proprietary_codecs
enable_platform_encrypted_dolby_vision = proprietary_codecs && is_win
# Enable logging override, e.g. enable DVLOGs through level 2 at build time.
# On Cast devices, these are logged as INFO.
@ -108,15 +109,17 @@ declare_args() {
# Enable browser managed persistent metadata storage for EME persistent
# session and persistent usage record session.
enable_media_drm_storage = proprietary_codecs
enable_media_drm_storage = is_android || is_castos
# Enable HLS manifest parser and demuxer.
enable_hls_demuxer = proprietary_codecs
enable_hls_demuxer = proprietary_codecs && is_android
# Enable inclusion of the HEVC/H265 parser and also enable HEVC/H265 decoding
# with hardware acceleration assist. Enabled by default for fuzzer builds,
# Windows, Mac, and Android.
enable_hevc_parser_and_hw_decoder = proprietary_codecs
enable_hevc_parser_and_hw_decoder =
proprietary_codecs &&
(use_fuzzing_engine || is_win || is_apple || is_android || is_linux)
# Enable inclusion of VVC/H.266 parser/demuxer, and also enable VVC/H.266 decoding
# with hardware acceleration provided by platform. Disabled by default for all builds.
@ -133,9 +136,13 @@ declare_args() {
# platform. Always enable this for Lacros, it determines support at runtime.
# TODO(crbug.com/1336055): Revisit the default value for this setting as it
# applies to video-capable devices.
enable_platform_hevc = proprietary_codecs
enable_platform_hevc =
proprietary_codecs && (enable_hevc_parser_and_hw_decoder ||
is_cast_media_device || is_chromeos_lacros)
enable_mse_mpeg2ts_stream_parser = proprietary_codecs
enable_mse_mpeg2ts_stream_parser =
proprietary_codecs &&
(enable_hls_demuxer || enable_cast_receiver || use_fuzzing_engine)
}
declare_args() {
@ -229,7 +236,9 @@ declare_args() {
declare_args() {
# Enables host verification for CDMs.
# Windows and Mac.
enable_cdm_host_verification = is_chrome_branded && !is_chrome_for_testing_branded
enable_cdm_host_verification =
enable_library_cdms && (is_mac || is_win) && is_chrome_branded &&
!is_chrome_for_testing_branded
# Enable Storage ID which is used by CDMs. This is only available with chrome
# branding, but may be overridden by other embedders.
@ -274,12 +283,6 @@ if (is_cast_media_device) {
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_win) {
_default_mojo_media_services = [
"audio_encoder",
"video_decoder",
]
_default_mojo_media_host = "gpu"
} else if (is_chromeos_ash || ((is_linux || is_chromeos_lacros) &&
(use_vaapi || use_v4l2_codec))) {
_default_mojo_media_services = [ "video_decoder" ]
@ -351,6 +354,7 @@ media_subcomponent_deps = [
"//media/filters",
"//media/formats",
"//media/muxers",
"//media/parsers",
"//media/renderers",
"//media/video",
]

View file

@ -1,277 +0,0 @@
#!special-case-list-v1
# Copyright 2024 The Chromium Authors, RobRich999, and Alex313031
# TODO(crbug.com/41488956): update to glob patterns
# This file defines which warnings should be ignored while running clang's
# control flow integrity sanitizer, as run by the cfi_flags build target.
# ***If you think you need to add an entry here, read this comment first.***
#
# Generally prefer to add an attribute to whichever function needs it, instead
# of adding entries to this file. This can be done in the Chromium codebase
# using the NO_SANITIZE macro, e.g.
#
# NO_SANITIZE("cfi-unrelated-cast")
#
# or outside of Chromium using the no_sanitize attribute directly (potentially
# with guards against non-Clang compilers; see the definition of NO_SANITIZE in
# Chromium), e.g.
#
# __attribute__((no_sanitize("cfi-unrelated-cast")))
[cfi-unrelated-cast|cfi-derived-cast]
# e.g. RolloverProtectedTickClock
fun:*MutableInstance*
# WTF allocators. See https://crbug.com/713293.
fun:*Allocate*Backing*
# WTF::ThreadSpecific
fun:*ThreadSpecific*
# LLVM's allocator
src:*llvm/Support/Allocator.h
# Deliberate bad cast to derived class to hide functions.
type:*BlockIUnknownMethods*
type:*BlockRefType*
type:*SkAutoTUnref*
type:*SkBlockComRef*
type:*RemoveIUnknown*
src:*atlcomcli.h
# src/base/win/event_trace_provider_unittest.cc
type:*EtwTraceProvider*
# b/64003142
fun:*internal_default_instance*
# CAtlArray<T> casts to uninitialized T*.
src:*atlcoll.h
# https://github.com/grpc/grpc/issues/19375
src:*third_party/grpc/src/src/core/lib/gprpp/inlined_vector.h
# https://crbug.com/994752
src:*third_party/spirv-cross/spirv-cross/spirv_cross_containers.hpp
# Vulkan memory allocator
src:*third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
#############################################################################
# Base class's constructor accesses a derived class.
fun:*DoublyLinkedListNode*
# RenderFrameObserverTracker<T>::RenderFrameObserverTracker()
fun:*content*RenderFrameObserverTracker*RenderFrame*
# RenderViewObserverTracker<T>::RenderViewObserverTracker()
fun:*content*RenderViewObserverTracker*RenderView*
fun:*RefCountedGarbageCollected*makeKeepAlive*
fun:*ThreadSafeRefCountedGarbageCollected*makeKeepAlive*
#############################################################################
# Base class's destructor accesses a derived class.
fun:*DatabaseContext*contextDestroyed*
# FIXME: Cannot handle template function LifecycleObserver<>::setContext,
# so exclude source file for now.
src:*lifecycle_observer.h*
#############################################################################
# Methods disabled due to perf considerations.
[cfi-vcall]
# Skia
# https://crbug.com/638056#c1
fun:*SkCanvas*onDrawRect*
# https://crbug.com/638064
fun:*SkCanvas*drawPicture*
# https://crbug.com/638060
fun:*SkCanvas*onDrawPicture*
# https://crbug.com/638064#c2
fun:*SkBaseDevice*accessPixels*
# https://crbug.com/638056
fun:*call_hline_blitter*
fun:*do_scanline*
fun:*antifilldot8*
# Unclear what could be done here
fun:*SkCanvas*drawRect*
fun:*SkPictureGpuAnalyzer*analyzePicture*
fun:*SkScalerContext*MakeRec*
# CC
# https://crbug.com/638056
fun:*LayerTreeHost*NotifySwapPromiseMonitorsOfSetNeedsCommit*
# WebKit
# The entries below have not been categorized
# cc::DisplayItemList::Inputs::~Inputs
fun:*cc*DisplayItemList*Inputs*
fun:*PaintInvalidationState*computePaintInvalidationRectInBacking*
fun:*AdjustAndMarkTrait*mark*
fun:*TraceTrait*trace*
fun:*ChromeClientImpl*scheduleAnimation*
fun:*hasAspectRatio*
fun:*nextBreakablePosition*
fun:*supportsCachedOffsets*
fun:*traceImpl*
#############################################################################
# Cross-DSO vcalls
[cfi-vcall|cfi-unrelated-cast|cfi-derived-cast]
# These classes are used to communicate between chrome.exe and
# chrome_child.dll (see src/sandbox/win/src/sandbox.h,
# src/chrome/app/chrome_main.cc).
type:sandbox::BrokerServices
type:sandbox::TargetPolicy
type:sandbox::TargetServices
#############################################################################
# Disabled indirect calls
[cfi-icall]
fun:ft_size_reset_iterator
######### Cross-DSO icalls using dynamically resolved symbols crbug.com/771365
# ANGLE
src:*third_party/angle/src/common/vulkan/vulkan_icd.cpp
src:*third_party/angle/src/libANGLE/*
src:*third_party/angle/src/libEGL/*
src:*third_party/angle/src/third_party/libXNVCtrl/NVCtrl.c
# third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp
fun:*GetPCIDevicesWithLibPCI*
# third_party/angle/src/common/event_tracer.cpp
fun:*GetTraceCategoryEnabledFlag*
fun:*AddTraceEvent*
# Dawn, calls to OpenGL and Vulkan function pointers from shared library.
src:*third_party/dawn/src/dawn/native/*
# Dawn uses std::function for callbacks from the main binary to
# liboptimization_guide_internal.so.
# TODO(crbug.com/41483637): See if we can avoid disabling CFI for std::function.
src:*third_party/libc*/invoke.h
src:*third_party/libc*/function.h
# PPAPI
src:*ppapi/*
src:*content/renderer/pepper*
fun:*PpapiThread*
fun:*BrokerProcessDispatcher*
# Ignore base::{Once, Repeating}Callback due to https://crbug.com/845855
fun:*FunctorTraits*
# Calls to auto-generated stubs by generate_stubs.py
src:*audio/pulse/pulse_stubs.cc
src:*media/gpu/vaapi/va_stubs.cc
# Calls to auto-generated stubs by generate_library_loader.py
src:*content/browser/speech/tts_linux.cc
src:*device/udev_linux/udev0_loader.cc
src:*device/udev_linux/udev1_loader.cc
# Calls to auto-generated stubs by ui/gl/generate_bindings.py
src:*ui/gl/gl_bindings_autogen_*
# Calls to vulkan function pointers from shared library.
src:*third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
src:*third_party/angle/third_party/vulkan-loader/src/loader*
src:*third_party/vulkan-deps/vulkan-loader/src/loader*
src:*third_party/vulkan-deps/vulkan-validation-layers/src/layers/*
src:*third_party/angle/src/common/vulkan/vulkan_icd.cpp
src:*components/os_crypt/sync/*
src:*content/browser/accessibility/browser_accessibility_auralinux.cc
src:*ui/accessibility/platform/ax_platform_node_auralinux.cc
src:*ui/accessibility/platform/ax_platform_atk_hyperlink.cc
src:*ui/accessibility/platform/ax_platform_node_auralinux_unittest.cc
src:*chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
src:*third_party/webrtc/modules/desktop_capture/linux/x_server_pixel_buffer.cc
src:*third_party/webrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
src:*media/cdm/*
src:*third_party/swiftshader/*
src:*base/native_library_unittest.cc
src:*ui/gtk/app_indicator_icon.cc
src:*ui/gtk/unity_service.cc
src:*components/cronet/native/*
src:*third_party/breakpad/breakpad/src/client/linux/handler/exception_handler_unittest.cc
# chrome/browser/ui/views/frame/dbus_appmenu.cc
fun:*dbus_appmenu*
# third_party/skia/include/gpu/gl/GrGLFunctions.h
fun:*GrGLFunction*
# Call to libcurl.so from the symupload utility
src:*third_party/breakpad/breakpad/src/common/linux/http_upload.cc
# Indirect call to Xlib.
fun:*XImageDeleter*
src:*mojo/public/c/system/thunks.cc
# Call to vulkan function pointers from shared library.
src:*/third_party/skia/src/gpu/vk/*
src:*/third_party/skia/src/gpu/ganesh/vk/*
src:*/third_party/skia/third_party/vulkanmemoryallocator/*
# The follow entries are speculatively disabled. They're included in the
# chromium build and include calls to dynamically resolved symbols; however,
# they do not trigger cfi-icall failures in unit tests or normal chrome usage.
# They're disabled to avoid failing in uncommon code paths. Be careful removing.
src:*net/http/http_auth_gssapi_posix.cc
src:*third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.cc
src:*third_party/crashpad/crashpad/snapshot/crashpad_info_client_options_test.cc
src:*third_party/skia/src/ports/SkFontHost_FreeType.cpp
######### Function pointers cast to incorrect type signatures
# libicu is currently compiled such that in libicu the 'UChar' type is a
# defined as a char16_t internally, but for the rest of chromium it's an
# unsigned short, causing mismatched type signatures for icalls to/from icu
# https://crbug.com/732026
src:*third_party/icu/source/common/*
src:*third_party/blink/renderer/platform/wtf/*
# v8/src/intl.cc
fun:*LocaleConvertCase*
# PropertyCallbackArguments::Call methods cast function pointers
src:*v8/src/api-arguments-inl.h
src:*v8/src/api/api-arguments-inl.h
# v8 callback that casts argument template parameters
fun:*PendingPhantomCallback*Invoke*
# weak_callback_ is cast from original type.
fun:*GlobalHandles*PostGarbageCollectionProcessing*
fun:*InvokeAccessorGetterCallback*
# XNNPACK casts incorrect function signature to pthreadpool task type.
src:*third_party/pthreadpool/src/src/fastpath.c
src:*third_party/pthreadpool/src/src/portable-api.c
######### Uncategorized
src:*native_client/*

View file

@ -97,14 +97,11 @@ NativeThemeGtk* NativeThemeGtk::instance() {
NativeThemeGtk::NativeThemeGtk()
: NativeThemeBase(/*should_only_use_dark_colors=*/false,
ui::SystemTheme::kGtk) {
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
base::BindRepeating(AddGtkNativeColorMixer));
OnThemeChanged(gtk_settings_get_default(), nullptr);
}
NativeThemeGtk::~NativeThemeGtk() {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}
void NativeThemeGtk::SetThemeCssOverride(ScopedCssProvider provider) {
@ -136,20 +133,15 @@ void NativeThemeGtk::SetThemeCssOverride(ScopedCssProvider provider) {
}
void NativeThemeGtk::NotifyOnNativeThemeUpdated() {
NativeTheme::NotifyOnNativeThemeUpdated();
// Update the preferred contrast settings for the NativeThemeAura instance and
// notify its observers about the change.
for (ui::NativeTheme* native_theme :
{ui::NativeTheme::GetInstanceForNativeUi(),
ui::NativeTheme::GetInstanceForWeb()}) {
native_theme->SetPreferredContrast(
UserHasContrastPreference()
? ui::NativeThemeBase::PreferredContrast::kMore
: ui::NativeThemeBase::PreferredContrast::kNoPreference);
native_theme->set_prefers_reduced_transparency(UserHasContrastPreference());
native_theme->NotifyOnNativeThemeUpdated();
// NativeThemeGtk pulls information about contrast from NativeThemeAura. As
// such, Aura must be updated with this information before we call
// NotifyOnNativeThemeUpdated().
if (auto* native_theme_aura = ui::NativeTheme::GetInstanceForNativeUi();
native_theme_aura->UpdateContrastRelatedStates(*this)) {
native_theme_aura->NotifyOnNativeThemeUpdated();
}
NativeTheme::NotifyOnNativeThemeUpdated();
}
void NativeThemeGtk::OnThemeChanged(GtkSettings* settings,