M126 stage 7

This commit is contained in:
Alexander Frick 2024-07-29 12:40:42 -05:00
parent 9afe5f5d19
commit bc032a22b6
12 changed files with 166 additions and 1050 deletions

View file

@ -205,7 +205,7 @@ declare_args() {
# ASAN and TSAN will occasionally hang during pa_context_connect(), so we
# disable PulseAudio when these configurations are enabled.
#
# TODO(crbug.com/986021): We shouldn't have to do this, but it's unclear why
# 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) {
@ -352,7 +352,7 @@ media_subcomponent_deps = [
"//media/audio",
"//media/base",
# TODO(crbug.com/583067): These files should not be in //media/base.
# TODO(crbug.com/41237623): These files should not be in //media/base.
"//media/base/android",
"//media/capabilities",
"//media/cdm",

View file

@ -289,7 +289,8 @@ bool IsAACSupported(const AudioType& type) {
#elif BUILDFLAG(IS_MAC)
return true;
#elif BUILDFLAG(IS_WIN)
return base::win::GetVersion() >= base::win::Version::WIN11_22H2;
return base::win::GetVersion() >= base::win::Version::WIN11_22H2 &&
!base::win::OSInfo::GetInstance()->IsWindowsNSku();
#else
return false;
#endif

View file

@ -1,972 +0,0 @@
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/ffmpeg/ffmpeg_common.h"
#include "base/hash/sha1.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "media/base/audio_decoder_config.h"
#include "media/base/decoder_buffer.h"
#include "media/base/encryption_scheme.h"
#include "media/base/media_util.h"
#include "media/base/supported_types.h"
#include "media/base/video_aspect_ratio.h"
#include "media/base/video_color_space.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_util.h"
#include "media/formats/mp4/box_definitions.h"
#include "media/media_buildflags.h"
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
#include "media/formats/mp4/aac.h"
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
#include "media/formats/mp4/hevc.h"
#endif
#endif
namespace media {
namespace {
EncryptionScheme GetEncryptionScheme(const AVStream* stream) {
AVDictionaryEntry* key =
av_dict_get(stream->metadata, "enc_key_id", nullptr, 0);
return key ? EncryptionScheme::kCenc : EncryptionScheme::kUnencrypted;
}
VideoDecoderConfig::AlphaMode GetAlphaMode(const AVStream* stream) {
AVDictionaryEntry* alpha_mode =
av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
return alpha_mode && !strcmp(alpha_mode->value, "1")
? VideoDecoderConfig::AlphaMode::kHasAlpha
: VideoDecoderConfig::AlphaMode::kIsOpaque;
}
VideoColorSpace GetGuessedColorSpace(const VideoColorSpace& color_space) {
return VideoColorSpace::FromGfxColorSpace(
// convert to gfx color space and make a guess.
color_space.GuessGfxColorSpace());
}
} // namespace
// Allows faster SIMD YUV convert. Also, FFmpeg overreads/-writes occasionally.
// See video_get_buffer() in libavcodec/utils.c.
static const int kFFmpegOutputBufferPaddingSize = 16;
static_assert(VideoFrame::kFrameSizePadding >= kFFmpegOutputBufferPaddingSize,
"VideoFrame padding size does not fit ffmpeg requirement");
static_assert(
VideoFrame::kFrameAddressAlignment >= kFFmpegBufferAddressAlignment &&
VideoFrame::kFrameAddressAlignment % kFFmpegBufferAddressAlignment == 0,
"VideoFrame frame address alignment does not fit ffmpeg requirement");
static const AVRational kMicrosBase = { 1, base::Time::kMicrosecondsPerSecond };
base::TimeDelta ConvertFromTimeBase(const AVRational& time_base,
int64_t timestamp) {
int64_t microseconds = av_rescale_q(timestamp, time_base, kMicrosBase);
return base::Microseconds(microseconds);
}
int64_t ConvertToTimeBase(const AVRational& time_base,
const base::TimeDelta& timestamp) {
return av_rescale_q(timestamp.InMicroseconds(), kMicrosBase, time_base);
}
AudioCodec CodecIDToAudioCodec(AVCodecID codec_id) {
switch (codec_id) {
case AV_CODEC_ID_AAC:
return AudioCodec::kAAC;
#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
case AV_CODEC_ID_AC3:
return AudioCodec::kAC3;
case AV_CODEC_ID_EAC3:
return AudioCodec::kEAC3;
#endif
case AV_CODEC_ID_MP3:
return AudioCodec::kMP3;
case AV_CODEC_ID_VORBIS:
return AudioCodec::kVorbis;
case AV_CODEC_ID_PCM_U8:
case AV_CODEC_ID_PCM_S16LE:
case AV_CODEC_ID_PCM_S24LE:
case AV_CODEC_ID_PCM_S32LE:
case AV_CODEC_ID_PCM_F32LE:
return AudioCodec::kPCM;
case AV_CODEC_ID_PCM_S16BE:
return AudioCodec::kPCM_S16BE;
case AV_CODEC_ID_PCM_S24BE:
return AudioCodec::kPCM_S24BE;
case AV_CODEC_ID_FLAC:
return AudioCodec::kFLAC;
case AV_CODEC_ID_PCM_ALAW:
return AudioCodec::kPCM_ALAW;
case AV_CODEC_ID_PCM_MULAW:
return AudioCodec::kPCM_MULAW;
case AV_CODEC_ID_OPUS:
return AudioCodec::kOpus;
case AV_CODEC_ID_ALAC:
return AudioCodec::kALAC;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case AV_CODEC_ID_MPEGH_3D_AUDIO:
return AudioCodec::kMpegHAudio;
#endif
default:
DVLOG(1) << "Unknown audio CodecID: " << codec_id;
}
return AudioCodec::kUnknown;
}
AVCodecID AudioCodecToCodecID(AudioCodec audio_codec,
SampleFormat sample_format) {
switch (audio_codec) {
case AudioCodec::kAAC:
return AV_CODEC_ID_AAC;
case AudioCodec::kALAC:
return AV_CODEC_ID_ALAC;
case AudioCodec::kMP3:
return AV_CODEC_ID_MP3;
case AudioCodec::kPCM:
switch (sample_format) {
case kSampleFormatU8:
return AV_CODEC_ID_PCM_U8;
case kSampleFormatS16:
return AV_CODEC_ID_PCM_S16LE;
case kSampleFormatS24:
return AV_CODEC_ID_PCM_S24LE;
case kSampleFormatS32:
return AV_CODEC_ID_PCM_S32LE;
case kSampleFormatF32:
return AV_CODEC_ID_PCM_F32LE;
default:
DVLOG(1) << "Unsupported sample format: " << sample_format;
}
break;
case AudioCodec::kPCM_S16BE:
return AV_CODEC_ID_PCM_S16BE;
case AudioCodec::kPCM_S24BE:
return AV_CODEC_ID_PCM_S24BE;
case AudioCodec::kVorbis:
return AV_CODEC_ID_VORBIS;
case AudioCodec::kFLAC:
return AV_CODEC_ID_FLAC;
case AudioCodec::kPCM_ALAW:
return AV_CODEC_ID_PCM_ALAW;
case AudioCodec::kPCM_MULAW:
return AV_CODEC_ID_PCM_MULAW;
case AudioCodec::kOpus:
return AV_CODEC_ID_OPUS;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case AudioCodec::kMpegHAudio:
return AV_CODEC_ID_MPEGH_3D_AUDIO;
#endif
default:
DVLOG(1) << "Unknown AudioCodec: " << audio_codec;
}
return AV_CODEC_ID_NONE;
}
// Converts an FFmpeg video codec ID into its corresponding supported codec id.
static VideoCodec CodecIDToVideoCodec(AVCodecID codec_id) {
switch (codec_id) {
case AV_CODEC_ID_H264:
return VideoCodec::kH264;
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
case AV_CODEC_ID_HEVC:
return VideoCodec::kHEVC;
#endif
case AV_CODEC_ID_THEORA:
return VideoCodec::kTheora;
case AV_CODEC_ID_MPEG4:
return VideoCodec::kMPEG4;
case AV_CODEC_ID_VP8:
return VideoCodec::kVP8;
case AV_CODEC_ID_VP9:
return VideoCodec::kVP9;
case AV_CODEC_ID_AV1:
return VideoCodec::kAV1;
default:
DVLOG(1) << "Unknown video CodecID: " << codec_id;
}
return VideoCodec::kUnknown;
}
AVCodecID VideoCodecToCodecID(VideoCodec video_codec) {
switch (video_codec) {
case VideoCodec::kH264:
return AV_CODEC_ID_H264;
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
case VideoCodec::kHEVC:
return AV_CODEC_ID_HEVC;
#endif
case VideoCodec::kTheora:
return AV_CODEC_ID_THEORA;
case VideoCodec::kMPEG4:
return AV_CODEC_ID_MPEG4;
case VideoCodec::kVP8:
return AV_CODEC_ID_VP8;
case VideoCodec::kVP9:
return AV_CODEC_ID_VP9;
case VideoCodec::kAV1:
return AV_CODEC_ID_AV1;
default:
DVLOG(1) << "Unknown VideoCodec: " << video_codec;
}
return AV_CODEC_ID_NONE;
}
static VideoCodecProfile ProfileIDToVideoCodecProfile(int profile) {
// Clear out the CONSTRAINED & INTRA flags which are strict subsets of the
// corresponding profiles with which they're used.
profile &= ~FF_PROFILE_H264_CONSTRAINED;
profile &= ~FF_PROFILE_H264_INTRA;
switch (profile) {
case FF_PROFILE_H264_BASELINE:
return H264PROFILE_BASELINE;
case FF_PROFILE_H264_MAIN:
return H264PROFILE_MAIN;
case FF_PROFILE_H264_EXTENDED:
return H264PROFILE_EXTENDED;
case FF_PROFILE_H264_HIGH:
return H264PROFILE_HIGH;
case FF_PROFILE_H264_HIGH_10:
return H264PROFILE_HIGH10PROFILE;
case FF_PROFILE_H264_HIGH_422:
return H264PROFILE_HIGH422PROFILE;
case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
return H264PROFILE_HIGH444PREDICTIVEPROFILE;
default:
DVLOG(1) << "Unknown profile id: " << profile;
}
return VIDEO_CODEC_PROFILE_UNKNOWN;
}
static int VideoCodecProfileToProfileID(VideoCodecProfile profile) {
switch (profile) {
case H264PROFILE_BASELINE:
return FF_PROFILE_H264_BASELINE;
case H264PROFILE_MAIN:
return FF_PROFILE_H264_MAIN;
case H264PROFILE_EXTENDED:
return FF_PROFILE_H264_EXTENDED;
case H264PROFILE_HIGH:
return FF_PROFILE_H264_HIGH;
case H264PROFILE_HIGH10PROFILE:
return FF_PROFILE_H264_HIGH_10;
case H264PROFILE_HIGH422PROFILE:
return FF_PROFILE_H264_HIGH_422;
case H264PROFILE_HIGH444PREDICTIVEPROFILE:
return FF_PROFILE_H264_HIGH_444_PREDICTIVE;
default:
DVLOG(1) << "Unknown VideoCodecProfile: " << profile;
}
return FF_PROFILE_UNKNOWN;
}
SampleFormat AVSampleFormatToSampleFormat(AVSampleFormat sample_format,
AVCodecID codec_id) {
switch (sample_format) {
case AV_SAMPLE_FMT_U8:
return kSampleFormatU8;
case AV_SAMPLE_FMT_S16:
return kSampleFormatS16;
case AV_SAMPLE_FMT_S32:
if (codec_id == AV_CODEC_ID_PCM_S24LE)
return kSampleFormatS24;
else
return kSampleFormatS32;
case AV_SAMPLE_FMT_FLT:
return kSampleFormatF32;
case AV_SAMPLE_FMT_S16P:
return kSampleFormatPlanarS16;
case AV_SAMPLE_FMT_S32P:
return kSampleFormatPlanarS32;
case AV_SAMPLE_FMT_FLTP:
return kSampleFormatPlanarF32;
default:
DVLOG(1) << "Unknown AVSampleFormat: " << sample_format;
}
return kUnknownSampleFormat;
}
static AVSampleFormat SampleFormatToAVSampleFormat(SampleFormat sample_format) {
switch (sample_format) {
case kSampleFormatU8:
return AV_SAMPLE_FMT_U8;
case kSampleFormatS16:
return AV_SAMPLE_FMT_S16;
// pcm_s24le is treated as a codec with sample format s32 in ffmpeg
case kSampleFormatS24:
case kSampleFormatS32:
return AV_SAMPLE_FMT_S32;
case kSampleFormatF32:
return AV_SAMPLE_FMT_FLT;
case kSampleFormatPlanarS16:
return AV_SAMPLE_FMT_S16P;
case kSampleFormatPlanarF32:
return AV_SAMPLE_FMT_FLTP;
default:
DVLOG(1) << "Unknown SampleFormat: " << sample_format;
}
return AV_SAMPLE_FMT_NONE;
}
bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
EncryptionScheme encryption_scheme,
AudioDecoderConfig* config) {
DCHECK_EQ(codec_context->codec_type, AVMEDIA_TYPE_AUDIO);
AudioCodec codec = CodecIDToAudioCodec(codec_context->codec_id);
SampleFormat sample_format = AVSampleFormatToSampleFormat(
codec_context->sample_fmt, codec_context->codec_id);
ChannelLayout channel_layout =
codec_context->ch_layout.nb_channels > 8
? CHANNEL_LAYOUT_DISCRETE
: ChannelLayoutToChromeChannelLayout(
codec_context->ch_layout.u.mask,
codec_context->ch_layout.nb_channels);
switch (codec) {
// For AC3/EAC3 we enable only demuxing, but not decoding, so FFmpeg does
// not fill |sample_fmt|.
case AudioCodec::kAC3:
case AudioCodec::kEAC3:
#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
// The spec for AC3/EAC3 audio is ETSI TS 102 366. According to sections
// F.3.1 and F.5.1 in that spec the sample_format for AC3/EAC3 must be 16.
sample_format = kSampleFormatS16;
#else
NOTREACHED();
#endif
break;
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
case AudioCodec::kMpegHAudio:
channel_layout = CHANNEL_LAYOUT_BITSTREAM;
sample_format = kSampleFormatMpegHAudio;
break;
#endif
default:
break;
}
base::TimeDelta seek_preroll;
if (codec_context->seek_preroll > 0) {
seek_preroll = base::Microseconds(codec_context->seek_preroll * 1000000.0 /
codec_context->sample_rate);
}
// AVStream occasionally has invalid extra data. See http://crbug.com/517163
if ((codec_context->extradata_size == 0) !=
(codec_context->extradata == nullptr)) {
LOG(ERROR) << __func__
<< (codec_context->extradata == nullptr ? " NULL" : " Non-NULL")
<< " extra data cannot have size of "
<< codec_context->extradata_size << ".";
return false;
}
std::vector<uint8_t> extra_data;
if (codec_context->extradata_size > 0) {
extra_data.assign(codec_context->extradata,
codec_context->extradata + codec_context->extradata_size);
}
config->Initialize(codec, sample_format, channel_layout, codec_context->sample_rate,
extra_data, encryption_scheme, seek_preroll,
codec_context->delay);
if (channel_layout == CHANNEL_LAYOUT_DISCRETE)
config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels);
#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
// These are bitstream formats unknown to ffmpeg, so they don't have
// a known sample format size.
if (codec == AudioCodec::kAC3 || codec == AudioCodec::kEAC3)
return true;
#endif
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
if (codec == AudioCodec::kMpegHAudio)
return true;
#endif
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
if (codec == AudioCodec::kAAC) {
config->set_aac_extra_data(extra_data);
// TODO(dalecurtis): Just use the profile from the codec context if ffmpeg
// ever starts supporting xHE-AAC.
if (codec_context->profile == FF_PROFILE_UNKNOWN) {
// Errors aren't fatal here, so just drop any MediaLog messages.
NullMediaLog media_log;
mp4::AAC aac_parser;
if (aac_parser.Parse(extra_data, &media_log))
config->set_profile(aac_parser.GetProfile());
}
}
#endif
// Verify that AudioConfig.bytes_per_channel was calculated correctly for
// codecs that have |sample_fmt| set by FFmpeg.
DCHECK_EQ(av_get_bytes_per_sample(codec_context->sample_fmt),
config->bytes_per_channel());
return true;
}
std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext>
AVStreamToAVCodecContext(const AVStream* stream) {
std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context(
avcodec_alloc_context3(nullptr));
if (avcodec_parameters_to_context(codec_context.get(), stream->codecpar) <
0) {
return nullptr;
}
return codec_context;
}
bool AVStreamToAudioDecoderConfig(const AVStream* stream,
AudioDecoderConfig* config) {
std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context(
AVStreamToAVCodecContext(stream));
if (!codec_context)
return false;
return AVCodecContextToAudioDecoderConfig(
codec_context.get(), GetEncryptionScheme(stream), config);
}
void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config,
AVCodecContext* codec_context) {
codec_context->codec_type = AVMEDIA_TYPE_AUDIO;
codec_context->codec_id = AudioCodecToCodecID(config.codec(),
config.sample_format());
codec_context->sample_fmt = SampleFormatToAVSampleFormat(
config.sample_format());
// TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses
// said information to decode.
codec_context->ch_layout.nb_channels = config.channels();
codec_context->sample_rate = config.samples_per_second();
if (config.extra_data().empty()) {
codec_context->extradata = nullptr;
codec_context->extradata_size = 0;
} else {
codec_context->extradata_size = config.extra_data().size();
codec_context->extradata = reinterpret_cast<uint8_t*>(
av_malloc(config.extra_data().size() + AV_INPUT_BUFFER_PADDING_SIZE));
memcpy(codec_context->extradata, &config.extra_data()[0],
config.extra_data().size());
memset(codec_context->extradata + config.extra_data().size(), '\0',
AV_INPUT_BUFFER_PADDING_SIZE);
}
}
bool AVStreamToVideoDecoderConfig(const AVStream* stream,
VideoDecoderConfig* config) {
std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context(
AVStreamToAVCodecContext(stream));
if (!codec_context)
return false;
// TODO(vrk): This assumes decoded frame data starts at (0, 0), which is true
// for now, but may not always be true forever. Fix this in the future.
gfx::Rect visible_rect(codec_context->width, codec_context->height);
gfx::Size coded_size = visible_rect.size();
gfx::HDRMetadata hdr_metadata;
// In some cases a container may have a DAR but no PAR, but FFmpeg translates
// everything to PAR. It is possible to get the render width and height, but I
// didn't find a way to determine whether that should be preferred to the PAR.
VideoAspectRatio aspect_ratio;
if (stream->sample_aspect_ratio.num) {
aspect_ratio = VideoAspectRatio::PAR(stream->sample_aspect_ratio.num,
stream->sample_aspect_ratio.den);
} else if (codec_context->sample_aspect_ratio.num) {
aspect_ratio =
VideoAspectRatio::PAR(codec_context->sample_aspect_ratio.num,
codec_context->sample_aspect_ratio.den);
}
// Used to guess color space and to create the config. The first use should
// probably change to coded size, and the second should be removed as part of
// crbug.com/1214061.
gfx::Size natural_size = aspect_ratio.GetNaturalSize(visible_rect);
VideoCodec codec = CodecIDToVideoCodec(codec_context->codec_id);
// Without the ffmpeg decoder configured, libavformat is unable to get the
// profile, format, or coded size. So choose sensible defaults and let
// decoders fail later if the configuration is actually unsupported.
//
// TODO(chcunningham): We need real profiles for all of the codecs below to
// actually handle capabilities requests correctly. http://crbug.com/784610
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
// Prefer the color space found by libavcodec if available
VideoColorSpace color_space =
VideoColorSpace(codec_context->color_primaries, codec_context->color_trc,
codec_context->colorspace,
codec_context->color_range == AVCOL_RANGE_JPEG
? gfx::ColorSpace::RangeID::FULL
: gfx::ColorSpace::RangeID::LIMITED);
VideoDecoderConfig::AlphaMode alpha_mode = GetAlphaMode(stream);
switch (codec) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
case VideoCodec::kH264: {
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
// if the profile is still unknown, try to extract it from
// the extradata using the internal parser
if (profile == VIDEO_CODEC_PROFILE_UNKNOWN && codec_context->extradata &&
codec_context->extradata_size) {
mp4::AVCDecoderConfigurationRecord avc_config;
if (avc_config.Parse(codec_context->extradata,
codec_context->extradata_size)) {
profile = ProfileIDToVideoCodecProfile(avc_config.profile_indication);
}
}
// All the heuristics failed, let's assign a default profile
if (profile == VIDEO_CODEC_PROFILE_UNKNOWN)
profile = H264PROFILE_BASELINE;
break;
}
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
case VideoCodec::kHEVC: {
int hevc_profile = -1;
// We need to parse extradata each time, because we wont add ffmpeg
// hevc decoder & parser to chromium and codec_context->profile
// should always be FF_PROFILE_UNKNOWN (-99) here
if (codec_context->extradata && codec_context->extradata_size) {
mp4::HEVCDecoderConfigurationRecord hevc_config;
if (hevc_config.Parse(codec_context->extradata,
codec_context->extradata_size)) {
hevc_profile = hevc_config.general_profile_idc;
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
if (!color_space.IsSpecified()) {
// We should try to parsed color space from SPS if the
// result from libavcodec is not specified in case
// that some encoder not write extra colorspace info to
// the container
color_space = hevc_config.GetColorSpace();
}
hdr_metadata = hevc_config.GetHDRMetadata();
alpha_mode = hevc_config.GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
}
}
// The values of general_profile_idc are taken from the HEVC standard, see
// the latest https://www.itu.int/rec/T-REC-H.265/en
switch (hevc_profile) {
case 1:
profile = HEVCPROFILE_MAIN;
break;
case 2:
profile = HEVCPROFILE_MAIN10;
break;
case 3:
profile = HEVCPROFILE_MAIN_STILL_PICTURE;
break;
case 4:
profile = HEVCPROFILE_REXT;
break;
case 5:
profile = HEVCPROFILE_HIGH_THROUGHPUT;
break;
case 6:
profile = HEVCPROFILE_MULTIVIEW_MAIN;
break;
case 7:
profile = HEVCPROFILE_SCALABLE_MAIN;
break;
case 8:
profile = HEVCPROFILE_3D_MAIN;
break;
case 9:
profile = HEVCPROFILE_SCREEN_EXTENDED;
break;
case 10:
profile = HEVCPROFILE_SCALABLE_REXT;
break;
case 11:
profile = HEVCPROFILE_HIGH_THROUGHPUT_SCREEN_EXTENDED;
break;
default:
// Always assign a default if all heuristics fail.
profile = HEVCPROFILE_MAIN;
break;
}
break;
}
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
case VideoCodec::kVP8:
profile = VP8PROFILE_ANY;
break;
case VideoCodec::kVP9:
switch (codec_context->profile) {
case FF_PROFILE_VP9_0:
profile = VP9PROFILE_PROFILE0;
break;
case FF_PROFILE_VP9_1:
profile = VP9PROFILE_PROFILE1;
break;
case FF_PROFILE_VP9_2:
profile = VP9PROFILE_PROFILE2;
break;
case FF_PROFILE_VP9_3:
profile = VP9PROFILE_PROFILE3;
break;
default:
profile = VP9PROFILE_MIN;
break;
}
break;
#if BUILDFLAG(ENABLE_AV1_DECODER)
case VideoCodec::kAV1:
profile = AV1PROFILE_PROFILE_MAIN;
if (codec_context->extradata && codec_context->extradata_size) {
mp4::AV1CodecConfigurationRecord av1_config;
if (av1_config.Parse(codec_context->extradata,
codec_context->extradata_size)) {
profile = av1_config.profile;
} else {
DLOG(WARNING) << "Failed to parse AV1 extra data for profile.";
}
}
break;
#endif // BUILDFLAG(ENABLE_AV1_DECODER)
case VideoCodec::kTheora:
profile = THEORAPROFILE_ANY;
break;
default:
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
}
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
// information from the container should take precedence over color space
// information from the VP9 stream. However, if we infer the color space
// based on resolution here, it looks as if it came from the container.
// Since this inference causes color shifts and is slated to go away
// we just skip it for VP9 and leave the color space undefined, which
// will make the VP9 decoder behave correctly..
// We also ignore the resolution for AV1, since it's new and it's easy
// to make it behave correctly from the get-go.
// TODO(hubbe): Skip this inference for all codecs.
if (codec_context->codec_id != AV_CODEC_ID_VP9 &&
codec_context->codec_id != AV_CODEC_ID_AV1) {
// Otherwise, assume that SD video is usually Rec.601, and HD is usually
// Rec.709.
color_space = (natural_size.height() < 720) ? VideoColorSpace::REC601()
: VideoColorSpace::REC709();
}
} else if (codec_context->codec_id == AV_CODEC_ID_H264 &&
codec_context->colorspace == AVCOL_SPC_RGB &&
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt) ==
PIXEL_FORMAT_I420) {
// Some H.264 videos contain a VUI that specifies a color matrix of GBR,
// when they are actually ordinary YUV. Only 4:2:0 formats are checked,
// because GBR is reasonable for 4:4:4 content. See crbug.com/1067377.
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) &&
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt) ==
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
// will cause IsHevcProfileSupported return "false" and fail to playback.
// make a guess can at least make these videos able to play. See
// crbug.com/1374270.
color_space = GetGuessedColorSpace(color_space);
}
// AVCodecContext occasionally has invalid extra data. See
// http://crbug.com/517163
if (codec_context->extradata != nullptr &&
codec_context->extradata_size == 0) {
DLOG(ERROR) << __func__ << " Non-Null extra data cannot have size of 0.";
return false;
}
std::vector<uint8_t> extra_data;
if (codec_context->extradata_size > 0) {
extra_data.assign(codec_context->extradata,
codec_context->extradata + codec_context->extradata_size);
}
VideoTransformation video_transformation = VideoTransformation();
for (int i = 0; i < stream->codecpar->nb_coded_side_data; ++i) {
const auto& side_data = stream->codecpar->coded_side_data[i];
switch (side_data.type) {
case AV_PKT_DATA_DISPLAYMATRIX: {
CHECK_EQ(side_data.size, sizeof(int32_t) * 3 * 3);
video_transformation = VideoTransformation::FromFFmpegDisplayMatrix(
reinterpret_cast<int32_t*>(side_data.data));
break;
}
case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: {
AVMasteringDisplayMetadata* mdcv =
reinterpret_cast<AVMasteringDisplayMetadata*>(side_data.data);
gfx::HdrMetadataSmpteSt2086 smpte_st_2086;
if (mdcv->has_primaries) {
smpte_st_2086.primaries = {
static_cast<float>(av_q2d(mdcv->display_primaries[0][0])),
static_cast<float>(av_q2d(mdcv->display_primaries[0][1])),
static_cast<float>(av_q2d(mdcv->display_primaries[1][0])),
static_cast<float>(av_q2d(mdcv->display_primaries[1][1])),
static_cast<float>(av_q2d(mdcv->display_primaries[2][0])),
static_cast<float>(av_q2d(mdcv->display_primaries[2][1])),
static_cast<float>(av_q2d(mdcv->white_point[0])),
static_cast<float>(av_q2d(mdcv->white_point[1])),
};
}
if (mdcv->has_luminance) {
smpte_st_2086.luminance_max = av_q2d(mdcv->max_luminance);
smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance);
}
// TODO(https://crbug.com/1446302): Consider rejecting metadata that
// does not specify all values.
if (mdcv->has_primaries || mdcv->has_luminance) {
hdr_metadata.smpte_st_2086 = smpte_st_2086;
}
break;
}
case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: {
AVContentLightMetadata* clli =
reinterpret_cast<AVContentLightMetadata*>(side_data.data);
hdr_metadata.cta_861_3 =
gfx::HdrMetadataCta861_3(clli->MaxCLL, clli->MaxFALL);
break;
}
#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
case AV_PKT_DATA_DOVI_CONF: {
AVDOVIDecoderConfigurationRecord* dovi =
reinterpret_cast<AVDOVIDecoderConfigurationRecord*>(side_data.data);
VideoType type;
type.codec = VideoCodec::kDolbyVision;
type.level = dovi->dv_level;
type.color_space = color_space;
type.hdr_metadata_type = gfx::HdrMetadataType::kNone;
switch (dovi->dv_profile) {
case 0:
type.profile = VideoCodecProfile::DOLBYVISION_PROFILE0;
break;
case 5:
type.profile = VideoCodecProfile::DOLBYVISION_PROFILE5;
break;
case 7:
type.profile = VideoCodecProfile::DOLBYVISION_PROFILE7;
break;
case 8:
type.profile = VideoCodecProfile::DOLBYVISION_PROFILE8;
break;
case 9:
type.profile = VideoCodecProfile::DOLBYVISION_PROFILE9;
break;
default:
type.profile = VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN;
break;
}
// Treat dolby vision contents as dolby vision codec only if the
// device support clear DV decoding, otherwise use the original
// HEVC or AVC codec and profile.
if (media::IsSupportedVideoType(type)) {
codec = type.codec;
profile = type.profile;
}
break;
}
#endif // BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
default:
break;
}
}
// TODO(tmathmeyer) ffmpeg can't provide us with an actual video rotation yet.
config->Initialize(codec, profile, alpha_mode, color_space,
video_transformation, coded_size, visible_rect,
natural_size, extra_data, GetEncryptionScheme(stream));
// Set the aspect ratio explicitly since our version hasn't been rounded.
config->set_aspect_ratio(aspect_ratio);
if (hdr_metadata.IsValid()) {
config->set_hdr_metadata(hdr_metadata);
}
return true;
}
void VideoDecoderConfigToAVCodecContext(
const VideoDecoderConfig& config,
AVCodecContext* codec_context) {
codec_context->codec_type = AVMEDIA_TYPE_VIDEO;
codec_context->codec_id = VideoCodecToCodecID(config.codec());
codec_context->profile = VideoCodecProfileToProfileID(config.profile());
codec_context->coded_width = config.coded_size().width();
codec_context->coded_height = config.coded_size().height();
if (config.color_space_info().range == gfx::ColorSpace::RangeID::FULL)
codec_context->color_range = AVCOL_RANGE_JPEG;
if (config.extra_data().empty()) {
codec_context->extradata = nullptr;
codec_context->extradata_size = 0;
} else {
codec_context->extradata_size = config.extra_data().size();
codec_context->extradata = reinterpret_cast<uint8_t*>(
av_malloc(config.extra_data().size() + AV_INPUT_BUFFER_PADDING_SIZE));
memcpy(codec_context->extradata, &config.extra_data()[0],
config.extra_data().size());
memset(codec_context->extradata + config.extra_data().size(), '\0',
AV_INPUT_BUFFER_PADDING_SIZE);
}
}
ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout, int channels) {
switch (layout) {
case AV_CH_LAYOUT_MONO:
return CHANNEL_LAYOUT_MONO;
case AV_CH_LAYOUT_STEREO:
return CHANNEL_LAYOUT_STEREO;
case AV_CH_LAYOUT_2POINT1:
return CHANNEL_LAYOUT_2POINT1;
case AV_CH_LAYOUT_2_1:
return CHANNEL_LAYOUT_2_1;
case AV_CH_LAYOUT_SURROUND:
return CHANNEL_LAYOUT_SURROUND;
case AV_CH_LAYOUT_3POINT1:
return CHANNEL_LAYOUT_3_1;
case AV_CH_LAYOUT_4POINT0:
return CHANNEL_LAYOUT_4_0;
case AV_CH_LAYOUT_4POINT1:
return CHANNEL_LAYOUT_4_1;
case AV_CH_LAYOUT_2_2:
return CHANNEL_LAYOUT_2_2;
case AV_CH_LAYOUT_QUAD:
return CHANNEL_LAYOUT_QUAD;
case AV_CH_LAYOUT_5POINT0:
return CHANNEL_LAYOUT_5_0;
case AV_CH_LAYOUT_5POINT1:
return CHANNEL_LAYOUT_5_1;
case AV_CH_LAYOUT_5POINT0_BACK:
return CHANNEL_LAYOUT_5_0_BACK;
case AV_CH_LAYOUT_5POINT1_BACK:
return CHANNEL_LAYOUT_5_1_BACK;
case AV_CH_LAYOUT_6POINT0:
return CHANNEL_LAYOUT_6_0;
case AV_CH_LAYOUT_6POINT0_FRONT:
return CHANNEL_LAYOUT_6_0_FRONT;
case AV_CH_LAYOUT_HEXAGONAL:
return CHANNEL_LAYOUT_HEXAGONAL;
case AV_CH_LAYOUT_6POINT1:
return CHANNEL_LAYOUT_6_1;
case AV_CH_LAYOUT_6POINT1_BACK:
return CHANNEL_LAYOUT_6_1_BACK;
case AV_CH_LAYOUT_6POINT1_FRONT:
return CHANNEL_LAYOUT_6_1_FRONT;
case AV_CH_LAYOUT_7POINT0:
return CHANNEL_LAYOUT_7_0;
case AV_CH_LAYOUT_7POINT0_FRONT:
return CHANNEL_LAYOUT_7_0_FRONT;
case AV_CH_LAYOUT_7POINT1:
return CHANNEL_LAYOUT_7_1;
case AV_CH_LAYOUT_7POINT1_WIDE:
return CHANNEL_LAYOUT_7_1_WIDE;
case AV_CH_LAYOUT_7POINT1_WIDE_BACK:
return CHANNEL_LAYOUT_7_1_WIDE_BACK;
case AV_CH_LAYOUT_OCTAGONAL:
return CHANNEL_LAYOUT_OCTAGONAL;
case AV_CH_LAYOUT_STEREO_DOWNMIX:
return CHANNEL_LAYOUT_STEREO_DOWNMIX;
case AV_CH_FRONT_CENTER | AV_CH_LOW_FREQUENCY:
return CHANNEL_LAYOUT_1_1;
case AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT | AV_CH_LOW_FREQUENCY |
AV_CH_BACK_CENTER:
return CHANNEL_LAYOUT_3_1_BACK;
default:
// FFmpeg channel_layout is 0 for .wav and .mp3. Attempt to guess layout
// based on the channel count.
return GuessChannelLayout(channels);
}
}
#if !defined(ARCH_CPU_LITTLE_ENDIAN)
#error The code below assumes little-endianness.
#endif
VideoPixelFormat AVPixelFormatToVideoPixelFormat(AVPixelFormat pixel_format) {
// The YUVJ alternatives are FFmpeg's (deprecated, but still in use) way to
// specify a pixel format and full range color combination.
switch (pixel_format) {
case AV_PIX_FMT_YUV444P:
case AV_PIX_FMT_YUVJ444P:
return PIXEL_FORMAT_I444;
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUVJ420P:
return PIXEL_FORMAT_I420;
case AV_PIX_FMT_YUV422P:
case AV_PIX_FMT_YUVJ422P:
return PIXEL_FORMAT_I422;
case AV_PIX_FMT_YUVA420P:
return PIXEL_FORMAT_I420A;
case AV_PIX_FMT_YUV420P9LE:
return PIXEL_FORMAT_YUV420P9;
case AV_PIX_FMT_YUV420P10LE:
return PIXEL_FORMAT_YUV420P10;
case AV_PIX_FMT_YUV420P12LE:
return PIXEL_FORMAT_YUV420P12;
case AV_PIX_FMT_YUV422P9LE:
return PIXEL_FORMAT_YUV422P9;
case AV_PIX_FMT_YUV422P10LE:
return PIXEL_FORMAT_YUV422P10;
case AV_PIX_FMT_YUV422P12LE:
return PIXEL_FORMAT_YUV422P12;
case AV_PIX_FMT_YUV444P9LE:
return PIXEL_FORMAT_YUV444P9;
case AV_PIX_FMT_YUV444P10LE:
return PIXEL_FORMAT_YUV444P10;
case AV_PIX_FMT_YUV444P12LE:
return PIXEL_FORMAT_YUV444P12;
default:
// FFmpeg knows more pixel formats than Chromium cares about.
LOG(ERROR) << "Unsupported pixel format: " << pixel_format;
return PIXEL_FORMAT_UNKNOWN;
}
}
std::string AVErrorToString(int errnum) {
char errbuf[AV_ERROR_MAX_STRING_SIZE] = {0};
av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE);
return std::string(errbuf);
}
int32_t HashCodecName(const char* codec_name) {
// Use the first 32-bits from the SHA1 hash as the identifier.
int32_t hash;
memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4);
return hash;
}
} // namespace media

View file

@ -66,6 +66,13 @@ config("compiler") {
}
}
# Disable TLSDESC for riscv64 until the Android NDK supports it. While
# Chromium's clang turns it on by default for Android RISC-V devices, NDK r27
# currently has it disabled. This can likely be removed in NDK r28.
if (current_cpu == "riscv64") {
cflags += [ "-mtls-dialect=trad" ]
}
# $compile_api_level corresponds to the API level used for the sysroot path
# calculation in //build/config/android/config.gni
if (android_64bit_target_cpu) {
@ -87,6 +94,11 @@ config("compiler") {
ldflags += [ "-march=armv7-a" ]
}
if (current_cpu == "x86" || current_cpu == "x64") {
cflags += [ "-msse3" ]
ldflags += [ "-msse3" ]
}
# Assign any flags set for the C compiler to asmflags so that they are sent
# to the assembler.
asmflags = cflags

View file

@ -24,11 +24,11 @@ import("//chrome/browser/commerce/subscriptions/android/java_sources.gni")
import(
"//chrome/browser/commerce/subscriptions/test/android/test_java_sources.gni")
import("//chrome/browser/page_info/buildflags.gni")
import("//chrome/browser/password_manager/buildflags.gni")
import("//chrome/browser/share/android/java_sources.gni")
import("//chrome/chrome_paks.gni")
import("//chrome/common/features.gni")
import("//chrome/version.gni")
import("//components/password_manager/core/browser/buildflags.gni")
import("//components/plus_addresses/buildflags.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
@ -43,6 +43,7 @@ import("static_initializers.gni")
import("trichrome.gni")
assert(!is_cronet_build)
assert(enable_supervised_users)
if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
assert(current_toolchain != android_secondary_abi_toolchain)
@ -194,6 +195,7 @@ if (current_toolchain == default_toolchain) {
":ui_locale_string_resources",
"//chrome/android/webapk/libs/common:splash_resources",
"//chrome/app:java_strings_grd",
"//chrome/browser/android/customtabs/branding:java_resources",
"//chrome/browser/autofill/android:java_resources",
"//chrome/browser/commerce/price_change/android:java_resources",
"//chrome/browser/download/android:java_resources",
@ -209,11 +211,14 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/quick_delete:java_resources",
"//chrome/browser/search_resumption:java_resources",
"//chrome/browser/signin/services/android:java_resources",
"//chrome/browser/single_tab/android:java_resources",
"//chrome/browser/tab:java_resources",
"//chrome/browser/tab_resumption:java_resources",
"//chrome/browser/tab_ui/android:java_resources",
"//chrome/browser/ui/android/appmenu:java_resources",
"//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/management:java_resources",
"//chrome/browser/ui/android/omnibox:java_resources",
"//chrome/browser/ui/android/quickactionsearchwidget:java_resources",
@ -248,6 +253,7 @@ if (current_toolchain == default_toolchain) {
"//components/policy:app_restrictions_resources",
"//components/strings:components_locale_settings_grd",
"//components/strings:components_strings_grd",
"//components/strings:privacy_sandbox_strings_grd",
"//components/subresource_filter/android:java_resources",
"//components/translate/content/android:java_resources",
"//components/webapps/browser/android:java_resources",
@ -311,7 +317,6 @@ if (current_toolchain == default_toolchain) {
":chrome_app_java_resources",
":chrome_public_apk_template_resources",
":google_api_keys_java",
":update_proto_java",
":usage_stats_proto_java",
"$google_play_services_package:google_play_services_auth_base_java",
"$google_play_services_package:google_play_services_base_java",
@ -355,7 +360,6 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/autofill/android:java",
"//chrome/browser/auxiliary_search:java",
"//chrome/browser/back_press/android:java",
"//chrome/browser/banners/android:java",
"//chrome/browser/battery/android:java",
"//chrome/browser/bluetooth/android:java",
"//chrome/browser/browser_controls/android:java",
@ -403,6 +407,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/notifications/chime/android:java",
"//chrome/browser/omaha/android:java",
"//chrome/browser/optimization_guide/android:java",
"//chrome/browser/page_image_service/android:java",
"//chrome/browser/page_load_metrics:java",
"//chrome/browser/paint_preview/android:java",
"//chrome/browser/partnerbookmarks:delegate_java",
@ -441,10 +446,17 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/share:java",
"//chrome/browser/share/android:java_resources",
"//chrome/browser/signin/services/android:java",
"//chrome/browser/single_tab/android:java",
"//chrome/browser/supervised_user:supervised_user_service_platform_delegate_java",
"//chrome/browser/supervised_user:website_parent_approval_java",
"//chrome/browser/sync/android:java",
"//chrome/browser/tab:java",
"//chrome/browser/tab_group:java",
"//chrome/browser/tab_group_sync:factory_java",
"//chrome/browser/tab_group_sync:features_java",
"//chrome/browser/tab_group_sync:java",
"//chrome/browser/tab_resumption:java",
"//chrome/browser/tab_ui/android:java",
"//chrome/browser/tabmodel:factory_java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/tabpersistence:java",
@ -454,12 +466,14 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/appmenu:java",
"//chrome/browser/ui/android/cars:java",
"//chrome/browser/ui/android/default_browser_promo:java",
"//chrome/browser/ui/android/desktop_windowing:java",
"//chrome/browser/ui/android/device_lock:java",
"//chrome/browser/ui/android/edge_to_edge:factory_java",
"//chrome/browser/ui/android/edge_to_edge:java",
"//chrome/browser/ui/android/fast_checkout:java",
"//chrome/browser/ui/android/favicon:java",
"//chrome/browser/ui/android/google_bottom_bar:java",
"//chrome/browser/ui/android/google_bottom_bar:proto_java",
"//chrome/browser/ui/android/hats:factory_java",
"//chrome/browser/ui/android/hats:java",
"//chrome/browser/ui/android/hats:message_ui_delegate_java",
@ -524,6 +538,7 @@ if (current_toolchain == default_toolchain) {
"//components/browser_ui/util/android:java",
"//components/browser_ui/webshare/android:java",
"//components/browser_ui/widget/android:java",
"//components/browsing_data/content/android:java",
"//components/browsing_data/core:java",
"//components/commerce/core:proto_java",
"//components/commerce/core/android:core_java",
@ -534,6 +549,7 @@ if (current_toolchain == default_toolchain) {
"//components/content_settings/android:java",
"//components/crash/android:anr_collector_java",
"//components/crash/android:java",
"//components/data_sharing/public:public_java",
"//components/device_reauth:device_reauth_java_enums",
"//components/digital_goods/mojom:mojom_java",
"//components/dom_distiller/content/browser/android:dom_distiller_content_java",
@ -581,7 +597,9 @@ if (current_toolchain == default_toolchain) {
"//components/navigation_interception/android:navigation_interception_java",
"//components/offline_items_collection/core:core_java",
"//components/omnibox/browser:browser_java",
"//components/omnibox/common:features_java",
"//components/optimization_guide/proto:optimization_guide_proto_java",
"//components/page_image_service/mojom:mojo_bindings_java",
"//components/page_info/android:java",
"//components/page_info/android:page_info_action_enum_java",
"//components/page_info/core:proto_java",
@ -600,6 +618,7 @@ if (current_toolchain == default_toolchain) {
"//components/profile_metrics:browser_profile_type_enum_java",
"//components/query_tiles:java",
"//components/safe_browsing/android:safe_browsing_java",
"//components/saved_tab_groups:java",
"//components/schema_org/common:mojom_java",
"//components/search_engines/android:java",
"//components/security_interstitials/content/android:java",
@ -614,6 +633,7 @@ if (current_toolchain == default_toolchain) {
"//components/strictmode/android:java",
"//components/stylus_handwriting/android:java",
"//components/subresource_filter/android:java",
"//components/supervised_user/android:supervised_user_preferences_java",
"//components/sync/android:sync_java",
"//components/sync/protocol:protocol_java",
"//components/sync_device_info:sync_device_info_java",
@ -675,6 +695,7 @@ if (current_toolchain == default_toolchain) {
"//third_party/androidx:androidx_asynclayoutinflater_asynclayoutinflater_appcompat_java",
"//third_party/androidx:androidx_browser_browser_java",
"//third_party/androidx:androidx_collection_collection_java",
"//third_party/androidx:androidx_constraintlayout_constraintlayout_java",
"//third_party/androidx:androidx_coordinatorlayout_coordinatorlayout_java",
"//third_party/androidx:androidx_customview_customview_java",
"//third_party/androidx:androidx_gridlayout_gridlayout_java",
@ -734,7 +755,7 @@ if (current_toolchain == default_toolchain) {
# Include sources from tab_management_java_sources.gni.
sources += public_tab_management_java_sources
# TODO(crbug/1422324): Make tab_ui/ a module so that these sources can be included in "chrome_all_java".
# 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
@ -770,17 +791,17 @@ if (current_toolchain == default_toolchain) {
resources_package = "org.chromium.chrome"
# TODO(crbug/1022172): Instead of adding source files, add it as a separate
# TODO(crbug.com/40106499): Instead of adding source files, add it as a separate
# dependency when circular deps is resolved.
sources += share_java_sources
deps += share_java_deps
# TODO(crbug/1186003): Instead of adding source files, add it as a separate
# TODO(crbug.com/40172295): Instead of adding source files, add it as a separate
# dependency when circular deps is resolved.
sources += price_tracking_java_sources
deps += price_tracking_java_deps
# TODO(crbug/1210158): Instead of adding source files, add it as a separate
# TODO(crbug.com/40182305): Instead of adding source files, add it as a separate
# dependency when circular deps is resolved.
sources += commerce_subscriptions_java_sources
deps += commerce_subscriptions_java_deps
@ -791,21 +812,13 @@ if (current_toolchain == default_toolchain) {
deps += [ "//printing:printing_java" ]
}
# TODO(crbug.com/1174713): This is temporary to not break downstream targets.
# TODO(crbug.com/40167648): This is temporary to not break downstream targets.
public_deps = [ "//chrome/browser/notifications:java" ]
if (password_manager_use_internal_android_resources) {
deps += [ "//clank/components/password_manager:java_resources" ]
}
if (enable_supervised_users) {
deps += [
"//chrome/browser/supervised_user:supervised_user_service_platform_delegate_java",
"//chrome/browser/supervised_user:website_parent_approval_java",
"//components/supervised_user/android:supervised_user_preferences_java",
]
}
if (page_info_use_internal_android_resources) {
deps += [ "//clank/components/page_info:java_resources" ]
}
@ -841,7 +854,9 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/android/content:java",
"//chrome/browser/android/httpclient:java",
"//chrome/browser/commerce/merchant_viewer/android:java",
"//chrome/browser/data_sharing:java",
"//chrome/browser/download/internal/android:java",
"//chrome/browser/facilitated_payments/ui/android/internal:java",
"//chrome/browser/hub/internal:java",
"//chrome/browser/mandatory_reauth/android/internal:java",
"//chrome/browser/password_check:internal_java",
@ -867,6 +882,7 @@ if (current_toolchain == default_toolchain) {
"//components/data_sharing/internal:internal_java",
"//components/gwp_asan/client/android:gwp_asan_java",
"//components/messages/android/internal:java",
"//components/saved_tab_groups:java",
"//components/segmentation_platform/internal:internal_java",
]
}
@ -897,11 +913,6 @@ if (current_toolchain == default_toolchain) {
sources = [ "//chrome/browser/vr/ui_test_input.h" ]
}
proto_java_library("update_proto_java") {
proto_path = "java/src/org/chromium/chrome/browser/omaha/metrics"
sources = [ "$proto_path/update_success_tracking.proto" ]
}
proto_java_library("usage_stats_proto_java") {
proto_path = "../browser/android/usage_stats"
sources = [ "$proto_path/website_event.proto" ]
@ -922,7 +933,7 @@ if (current_toolchain == default_toolchain) {
deps = [
"//chrome/browser/page_info:page_info_buildflags",
"//chrome/browser/password_manager:password_manager_buildflags",
"//components/password_manager/core/browser:password_manager_buildflags",
"//device/vr/buildflags",
]
}
@ -965,7 +976,6 @@ if (current_toolchain == default_toolchain) {
"//base/version_info/android:version_constants_java",
"//cc:cc_java",
"//cc/mojom:mojom_java",
"//chrome/android:update_proto_java",
"//chrome/android:usage_stats_proto_java",
"//chrome/android/features/android_library_factory:junit_tests",
"//chrome/android/features/keyboard_accessory:internal_java",
@ -995,7 +1005,6 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/autofill/android:junit",
"//chrome/browser/back_press/android:java",
"//chrome/browser/back_press/android:junit",
"//chrome/browser/banners/android:java",
"//chrome/browser/bluetooth/android:junit",
"//chrome/browser/browser_controls/android:java",
"//chrome/browser/browser_controls/android:junit",
@ -1005,10 +1014,12 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/commerce/price_tracking/android:java",
"//chrome/browser/commerce/price_tracking/proto:proto_java",
"//chrome/browser/commerce/subscriptions/android:subscriptions_java",
"//chrome/browser/content_extraction/android:java",
"//chrome/browser/contextmenu:java",
"//chrome/browser/creator/android:java",
"//chrome/browser/creator/android:junit",
"//chrome/browser/data_sharing:java",
"//chrome/browser/data_sharing:junit",
"//chrome/browser/dependency_injection:java",
"//chrome/browser/device:java",
"//chrome/browser/device:junit",
@ -1018,6 +1029,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/download/internal/android:junit",
"//chrome/browser/enterprise/util:java",
"//chrome/browser/enterprise/util:junit",
"//chrome/browser/facilitated_payments/ui/android/internal:junit",
"//chrome/browser/feature_engagement:java",
"//chrome/browser/feed/android:java",
"//chrome/browser/feed/android:junit",
@ -1027,6 +1039,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/flags:java",
"//chrome/browser/fullscreen/android:java",
"//chrome/browser/gsa:java",
"//chrome/browser/history:java",
"//chrome/browser/history_clusters:java",
"//chrome/browser/hub:factory_java",
"//chrome/browser/hub:java",
@ -1045,10 +1058,13 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/magic_stack/android:java",
"//chrome/browser/magic_stack/android:junit",
"//chrome/browser/mandatory_reauth/android/internal:junit",
"//chrome/browser/model_execution/android:delegate_java",
"//chrome/browser/notifications:java",
"//chrome/browser/notifications:junit_tests",
"//chrome/browser/omaha/android:java",
"//chrome/browser/omaha/android:update_proto_java",
"//chrome/browser/optimization_guide/android:java",
"//chrome/browser/page_image_service/android:junit",
"//chrome/browser/page_load_metrics:java",
"//chrome/browser/partnercustomizations:java",
"//chrome/browser/partnercustomizations:junit",
@ -1076,6 +1092,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/safety_check/android:java",
"//chrome/browser/safety_check/android:junit",
"//chrome/browser/safety_hub/android:java",
"//chrome/browser/safety_hub/android:junit",
"//chrome/browser/screenshot_monitor:java",
"//chrome/browser/search_engines/android:java",
"//chrome/browser/search_engines/android:junit",
@ -1085,13 +1102,21 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/share:java",
"//chrome/browser/signin/services/android:java",
"//chrome/browser/signin/services/android:junit",
"//chrome/browser/single_tab/android:java",
"//chrome/browser/single_tab/android:junit",
"//chrome/browser/supervised_user:junit",
"//chrome/browser/sync/android:java",
"//chrome/browser/tab:java",
"//chrome/browser/tab:junit",
"//chrome/browser/tab_group:java",
"//chrome/browser/tab_group:junit",
"//chrome/browser/tab_group_sync:factory_java",
"//chrome/browser/tab_group_sync:features_java",
"//chrome/browser/tab_group_sync:java",
"//chrome/browser/tab_group_sync:junit",
"//chrome/browser/tab_resumption:junit",
"//chrome/browser/tab_ui/android:java",
"//chrome/browser/tab_ui/android:junit",
"//chrome/browser/tabmodel:factory_java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/tabmodel:junit",
@ -1110,11 +1135,14 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/cars:junit",
"//chrome/browser/ui/android/default_browser_promo:java",
"//chrome/browser/ui/android/default_browser_promo:junit",
"//chrome/browser/ui/android/desktop_windowing:java",
"//chrome/browser/ui/android/desktop_windowing:junit",
"//chrome/browser/ui/android/device_lock:junit",
"//chrome/browser/ui/android/edge_to_edge:java",
"//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:junit",
"//chrome/browser/ui/android/hats:factory_java",
"//chrome/browser/ui/android/hats:junit",
"//chrome/browser/ui/android/hats/internal:junit",
@ -1134,12 +1162,15 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/night_mode:junit",
"//chrome/browser/ui/android/omnibox:java",
"//chrome/browser/ui/android/omnibox:junit",
"//chrome/browser/ui/android/page_insights:java",
"//chrome/browser/ui/android/page_insights:junit",
"//chrome/browser/ui/android/page_insights:proto_java",
"//chrome/browser/ui/android/pdf:java",
"//chrome/browser/ui/android/pdf:junit",
"//chrome/browser/ui/android/plus_addresses:junit",
"//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",
@ -1197,6 +1228,7 @@ if (current_toolchain == default_toolchain) {
"//components/content_relationship_verification/android:java",
"//components/content_relationship_verification/android:junit_test_support",
"//components/content_settings/android:content_settings_enums_java",
"//components/content_settings/android:java",
"//components/digital_goods/mojom:mojom_java",
"//components/dom_distiller/core/android:dom_distiller_core_java",
"//components/download/public/task:public_java",
@ -1204,6 +1236,7 @@ if (current_toolchain == default_toolchain) {
"//components/embedder_support/android:context_menu_java",
"//components/embedder_support/android:junit_test_support",
"//components/embedder_support/android:util_java",
"//components/external_intents/android:java",
"//components/externalauth/android:java",
"//components/externalauth/android:junit",
"//components/favicon/android:java",
@ -1234,6 +1267,7 @@ if (current_toolchain == default_toolchain) {
"//components/power_bookmarks/core:proto_java",
"//components/prefs/android:java",
"//components/profile_metrics:browser_profile_type_enum_java",
"//components/saved_tab_groups:java",
"//components/schema_org/common:mojom_java",
"//components/search_engines/android:java",
"//components/search_engines/android:test_utils_java",
@ -1257,6 +1291,7 @@ if (current_toolchain == default_toolchain) {
"//components/webapk/android/libs/client:java",
"//components/webapk/android/libs/common:java",
"//components/webapps/browser/android:java",
"//components/webapps/browser/android:webapps_jni_headers_java",
"//content/public/android:content_java",
"//content/public/common:common_java",
"//content/public/test/android:content_java_test_support",
@ -1279,6 +1314,7 @@ if (current_toolchain == default_toolchain) {
"//third_party/androidx:androidx_appcompat_appcompat_java",
"//third_party/androidx:androidx_browser_browser_java",
"//third_party/androidx:androidx_collection_collection_java",
"//third_party/androidx:androidx_constraintlayout_constraintlayout_java",
"//third_party/androidx:androidx_coordinatorlayout_coordinatorlayout_java",
"//third_party/androidx:androidx_lifecycle_lifecycle_runtime_java",
"//third_party/androidx:androidx_mediarouter_mediarouter_java",
@ -1420,9 +1456,7 @@ if (current_toolchain == default_toolchain) {
"javatests/src/org/chromium/chrome/browser/IntentFilterUnitTest.java",
"javatests/src/org/chromium/chrome/browser/IntentHandlerNativeTest.java",
"javatests/src/org/chromium/chrome/browser/autofill/AutofillUnitTest.java",
"javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkItemRowTest.java",
"javatests/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarTest.java",
"javatests/src/org/chromium/chrome/browser/bookmarks/PowerBookmarkShoppingItemRowTest.java",
"javatests/src/org/chromium/chrome/browser/bookmarks/PowerBookmarkUtilsTest.java",
"javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelBaseTest.java",
"javatests/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelEventFilterTest.java",
@ -1461,7 +1495,6 @@ if (current_toolchain == default_toolchain) {
"javatests/src/org/chromium/chrome/browser/tab/state/PersistedTabDataTest.java",
"javatests/src/org/chromium/chrome/browser/tabmodel/AsyncTabCreationParamsManagerTest.java",
"javatests/src/org/chromium/chrome/browser/tabmodel/RestoreMigrateTest.java",
"javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreUnitTest.java",
"javatests/src/org/chromium/chrome/browser/toolbar/HomeButtonTest.java",
"javatests/src/org/chromium/chrome/browser/toolbar/ToolbarSecurityIconTest.java",
"javatests/src/org/chromium/chrome/browser/webapps/WebappLaunchCauseMetricsTest.java",
@ -1640,7 +1673,6 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/autofill/android:java_resources",
"//chrome/browser/autofill/test:test_support_java",
"//chrome/browser/back_press/android:java",
"//chrome/browser/banners/android:java",
"//chrome/browser/browser_controls/android:java",
"//chrome/browser/browsing_data/android:java",
"//chrome/browser/commerce/android:java",
@ -1692,6 +1724,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/password_check:public_java",
"//chrome/browser/password_entry_edit/android/internal:javatests",
"//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/pwd_migration:java",
"//chrome/browser/policy/android:java",
@ -1720,6 +1753,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/share:java",
"//chrome/browser/share/android:java_resources",
"//chrome/browser/signin/services/android:java",
"//chrome/browser/single_tab/android:java",
"//chrome/browser/supervised_user:javatests",
"//chrome/browser/supervised_user:test_support_java",
"//chrome/browser/sync/android:java",
@ -1727,6 +1761,8 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/tab:critical_persisted_tab_data_proto_java",
"//chrome/browser/tab:java",
"//chrome/browser/tab_group:java",
"//chrome/browser/tab_group_sync:javatests",
"//chrome/browser/tab_ui/android:java",
"//chrome/browser/tabmodel:java",
"//chrome/browser/tabmodel/internal:java",
"//chrome/browser/tabpersistence:flatbuffer_java",
@ -1739,6 +1775,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/translate/android:javatests",
"//chrome/browser/ui/android/appmenu:java",
"//chrome/browser/ui/android/appmenu/test:test_support_java",
"//chrome/browser/ui/android/desktop_windowing:java",
"//chrome/browser/ui/android/device_lock:java",
"//chrome/browser/ui/android/device_lock:java_resources",
"//chrome/browser/ui/android/device_lock:javatests",
@ -1772,6 +1809,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/test/android:chrome_java_integration_test_support",
"//chrome/test/android:chrome_java_test_pagecontroller",
"//chrome/test/android:chrome_java_transit",
"//chrome/test/android:live_signin_test_util_public_impl_java",
"//chrome/test/android/test_trusted_web_activity:test_trusted_web_activity_java",
"//components/autofill/android:autofill_features_java",
"//components/autofill/android:autofill_java",
@ -1806,6 +1844,7 @@ if (current_toolchain == default_toolchain) {
"//components/browser_ui/util/android:java",
"//components/browser_ui/widget/android:java",
"//components/browser_ui/widget/android:test_support_java",
"//components/browsing_data/content/android:java",
"//components/browsing_data/core:java",
"//components/commerce/core:proto_java",
"//components/commerce/core/android:core_java",
@ -1835,6 +1874,7 @@ if (current_toolchain == default_toolchain) {
"//components/gcm_driver/instance_id/android:instance_id_driver_java",
"//components/gcm_driver/instance_id/android:instance_id_driver_test_support_java",
"//components/image_fetcher:java",
"//components/image_fetcher:test_support_java",
"//components/infobars/android:java",
"//components/infobars/core:infobar_enums_java",
"//components/javascript_dialogs/android:java",
@ -1854,6 +1894,7 @@ if (current_toolchain == default_toolchain) {
"//components/offline_items_collection/core:core_java",
"//components/omnibox/browser:browser_java",
"//components/omnibox/browser:junit_test_support",
"//components/omnibox/common:features_java",
"//components/optimization_guide/proto:optimization_guide_proto_java",
"//components/page_info/android:java",
"//components/page_info/android:page_info_action_enum_java",
@ -1865,6 +1906,7 @@ if (current_toolchain == default_toolchain) {
"//components/payments/content/android:payments_java_test_support",
"//components/payments/content/android:service_java",
"//components/payments/mojom:mojom_java",
"//components/permissions/android:content_settings_enums_java",
"//components/permissions/android:core_java",
"//components/permissions/android:java",
"//components/policy/android:policy_java",
@ -1903,6 +1945,7 @@ if (current_toolchain == default_toolchain) {
"//content/public/android:content_java",
"//content/public/common:common_java",
"//content/public/test/android:content_java_test_support",
"//content/public/test/android:content_transit_java",
"//media/base/android:java_switches",
"//media/base/android:media_java",
"//mojo/public/java:bindings_java",
@ -1943,6 +1986,7 @@ if (current_toolchain == default_toolchain) {
"//third_party/blink/public/mojom:mojom_core_java",
"//third_party/blink/public/mojom:mojom_mhtml_load_result_java",
"//third_party/blink/public/mojom:mojom_platform_java",
"//third_party/blink/public/mojom:web_feature_mojo_bindings_java",
"//third_party/flatbuffers:flatbuffers_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/jni_zero:jni_zero_java",
@ -2461,6 +2505,7 @@ if (current_toolchain == default_toolchain) {
testonly = true
sources = [
"javatests/src/org/chromium/chrome/browser/ServicificationBackgroundService.java",
"javatests/src/org/chromium/chrome/browser/gesturenav/ScreenshotCaptureTestHelper.java",
"javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java",
"javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java",
"javatests/src/org/chromium/chrome/browser/test/MockCertVerifierRuleAndroid.java",
@ -2473,6 +2518,7 @@ if (current_toolchain == default_toolchain) {
srcjar_deps = [ ":test_support_jni_headers" ]
sources = [
"javatests/src/org/chromium/chrome/browser/ServicificationBackgroundService.java",
"javatests/src/org/chromium/chrome/browser/gesturenav/ScreenshotCaptureTestHelper.java",
"javatests/src/org/chromium/chrome/browser/offlinepages/OfflineTestUtil.java",
"javatests/src/org/chromium/chrome/browser/sync/FakeServerHelper.java",
"javatests/src/org/chromium/chrome/browser/test/MockCertVerifierRuleAndroid.java",
@ -2507,6 +2553,7 @@ if (current_toolchain == default_toolchain) {
"../browser/android/servicification_background_service_jni.cc",
"../browser/android/ssl/mock_cert_verifier_rule_android.cc",
"../browser/android/ssl/mock_cert_verifier_rule_android.h",
"../browser/gesturenav/android/screenshot_capture_test_helper.cc",
"../browser/offline_pages/android/offline_test_util_jni.cc",
"../browser/sync/android/fake_server_helper_android.cc",
]
@ -2660,7 +2707,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/test_dummy/internal:base_module_java",
# Deps to pull services into base module.
# TODO(crbug.com/1126301): Consider moving these to the chrome module to
# TODO(crbug.com/40148088): Consider moving these to the chrome module to
# reduce base dex size.
"$google_play_services_package:google_play_services_cast_framework_java",
"//components/background_task_scheduler:background_task_scheduler_java",
@ -2799,16 +2846,18 @@ if (current_toolchain == default_toolchain) {
# As compared to chrome_public_test_apk, this target contains only unit tests
# that require on device capabilities. These tests are smaller, more tightly
# scoped, and do not leave lingering state after execution.
# TODO(crbug.com/1238057): Set clear rules for what tests can be added here.
# 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"
deps = [
":chrome_unit_test_java",
"//build/config/android/test/resource_overlay:unit_device_javatests",
"//chrome/android/features/tab_ui:unit_device_javatests",
"//chrome/browser/android/customtabs/branding:unit_device_javatests",
"//chrome/browser/android/intents:unit_device_javatests",
"//chrome/browser/back_press/android:unit_device_javatests",
"//chrome/browser/download/internal/android:unit_device_javatests",
"//chrome/browser/history:unit_device_javatests",
"//chrome/browser/hub:unit_device_javatests",
"//chrome/browser/hub/internal:unit_device_javatests",
"//chrome/browser/image_descriptions:unit_device_javatests",
@ -2825,7 +2874,6 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/ui/android/night_mode:unit_device_javatests",
"//chrome/browser/ui/android/omnibox:unit_device_javatests",
"//chrome/browser/ui/android/page_insights:unit_device_javatests",
"//chrome/browser/ui/android/searchactivityutils:unit_device_javatests",
"//chrome/browser/ui/android/signin:unit_device_javatests",
"//chrome/browser/ui/messages/android:unit_device_javatests",
"//components/browser_ui/accessibility/android:unit_device_javatests",
@ -2869,7 +2917,7 @@ if (current_toolchain == default_toolchain) {
is_unit_test = true
}
# TODO(crbug.com/1238057): Rename to chrome_public_integration_test_apk
# TODO(crbug.com/40193330): Rename to chrome_public_integration_test_apk
chrome_public_test_apk_tmpl("chrome_public_test_apk") {
# TODO(wnwen): Re-enable when new lint failures are disabled for test targets.
#enable_lint = true
@ -2885,6 +2933,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/browser/download/internal/android:javatests",
"//chrome/browser/engagement/android: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/recent_tabs/internal:recent_tabs_javatests",
@ -3071,15 +3120,22 @@ if (current_toolchain == default_toolchain) {
]
instrumentation_test_runner("monochrome_public_bundle_smoke_test") {
if (android_64bit_target_cpu && skip_secondary_abi_for_cq) {
apk_under_test = "//chrome/android:monochrome_64_public_bundle_apks"
if (!is_java_debug) {
proguard_mapping_path =
"$root_build_dir/apks/MonochromePublic64.aab.mapping"
if (android_64bit_target_cpu) {
if (skip_secondary_abi_for_cq) {
apk_under_test = "//chrome/android:monochrome_64_public_bundle_apks"
if (!is_java_debug) {
proguard_mapping_path =
"$root_build_dir/apks/MonochromePublic64.aab.mapping"
}
} else {
apk_under_test = "//chrome/android:monochrome_64_32_public_bundle_apks"
if (!is_java_debug) {
proguard_mapping_path =
"$root_build_dir/apks/MonochromePublic6432.aab.mapping"
}
}
} else {
apk_under_test =
"//chrome/android:${_main_monochrome_public_bundle_target}_apks"
apk_under_test = "//chrome/android:monochrome_public_bundle_apks"
if (!is_java_debug) {
proguard_mapping_path =
"$root_build_dir/apks/MonochromePublic.aab.mapping"
@ -3583,7 +3639,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/autofill/CreditCardScannerBridge.java",
"java/src/org/chromium/chrome/browser/autofill/SaveUpdateAddressProfilePrompt.java",
"java/src/org/chromium/chrome/browser/autofill/SaveUpdateAddressProfilePromptController.java",
"java/src/org/chromium/chrome/browser/autofill/fp/FacilitatedPaymentBottomSheetBridge.java",
"java/src/org/chromium/chrome/browser/autofill/iban/AutofillSaveIbanBottomSheetBridge.java",
"java/src/org/chromium/chrome/browser/autofill/save_card/AutofillSaveCardBottomSheetBridge.java",
"java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsDelegate.java",
@ -3608,7 +3663,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/compositor/CompositorView.java",
"java/src/org/chromium/chrome/browser/compositor/LayerTitleCache.java",
"java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanelContent.java",
"java/src/org/chromium/chrome/browser/compositor/layouts/content/TabContentManager.java",
"java/src/org/chromium/chrome/browser/compositor/scene_layer/ContextualSearchSceneLayer.java",
"java/src/org/chromium/chrome/browser/compositor/scene_layer/SolidColorSceneLayer.java",
"java/src/org/chromium/chrome/browser/compositor/scene_layer/StaticTabSceneLayer.java",
@ -3681,6 +3735,7 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/notifications/scheduler/NotificationSchedulerTask.java",
"java/src/org/chromium/chrome/browser/ntp/RecentTabsPagePrefs.java",
"java/src/org/chromium/chrome/browser/ntp/RecentlyClosedBridge.java",
"java/src/org/chromium/chrome/browser/ntp/RecentlyClosedTab.java",
"java/src/org/chromium/chrome/browser/offlinepages/AutoFetchNotifier.java",
"java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java",
"java/src/org/chromium/chrome/browser/offlinepages/OfflinePageArchivePublisherBridge.java",
@ -3704,7 +3759,7 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/password_manager/PasswordMigrationWarningBridge.java",
"java/src/org/chromium/chrome/browser/password_manager/settings/PasswordUIView.java",
"java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentAppBridge.java",
"java/src/org/chromium/chrome/browser/permissions/NotificationBlockedDialog.java",
"java/src/org/chromium/chrome/browser/permissions/PermissionBlockedDialog.java",
"java/src/org/chromium/chrome/browser/permissions/PermissionSettingsBridge.java",
"java/src/org/chromium/chrome/browser/permissions/PermissionUpdateRequester.java",
"java/src/org/chromium/chrome/browser/policy/PolicyAuditor.java",
@ -3721,10 +3776,9 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingReferringAppBridge.java",
"java/src/org/chromium/chrome/browser/safe_browsing/SafeBrowsingSettingsLauncher.java",
"java/src/org/chromium/chrome/browser/segmentation_platform/ContextualPageActionController.java",
"java/src/org/chromium/chrome/browser/settings/SettingsLauncherImpl.java",
"java/src/org/chromium/chrome/browser/sharing/SharingJNIBridge.java",
"java/src/org/chromium/chrome/browser/sharing/SharingServiceProxy.java",
"java/src/org/chromium/chrome/browser/sharing/click_to_call/ClickToCallMessageHandler.java",
"java/src/org/chromium/chrome/browser/sharing/shared_clipboard/SharedClipboardMessageHandler.java",
"java/src/org/chromium/chrome/browser/sharing/sms_fetcher/SmsFetcherMessageHandler.java",
"java/src/org/chromium/chrome/browser/signin/SigninBridge.java",
"java/src/org/chromium/chrome/browser/signin/SigninManagerImpl.java",
@ -3742,7 +3796,6 @@ generate_jni("chrome_jni_headers") {
"java/src/org/chromium/chrome/browser/tabmodel/TabModelJniBridge.java",
"java/src/org/chromium/chrome/browser/tabmodel/TabModelObserverJniBridge.java",
"java/src/org/chromium/chrome/browser/usage_stats/UsageStatsBridge.java",
"java/src/org/chromium/chrome/browser/webapps/PwaRestorePromoUtils.java",
"java/src/org/chromium/chrome/browser/webapps/WebApkDataProvider.java",
"java/src/org/chromium/chrome/browser/webapps/WebApkHandlerDelegate.java",
"java/src/org/chromium/chrome/browser/webapps/WebApkInstallService.java",
@ -3796,6 +3849,7 @@ group("jni_headers") {
"//chrome/browser/data_sharing:jni_headers",
"//chrome/browser/download/android:jni_headers",
"//chrome/browser/enterprise/util:jni_headers",
"//chrome/browser/facilitated_payments/ui/android:jni_headers",
"//chrome/browser/feature_engagement:jni_headers",
"//chrome/browser/flags:jni_headers",
"//chrome/browser/history:jni_headers",
@ -3812,6 +3866,8 @@ group("jni_headers") {
"//chrome/browser/search_engines/android:jni_headers",
"//chrome/browser/segmentation_platform:jni_headers",
"//chrome/browser/tab:jni_headers",
"//chrome/browser/tab_group_sync: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/fast_checkout:jni_headers",

View file

@ -336,7 +336,7 @@ template("chrome_common_apk_or_module_tmpl") {
resource_exclusion_regex += "|${_material_package}/xml.*badge_"
if (!is_java_debug) {
# TODO(crbug.com/993340): Update test goldens with webp versions of images.
# TODO(crbug.com/41475795): Update test goldens with webp versions of images.
if (!_is_test) {
png_to_webp = true
}
@ -558,6 +558,12 @@ template("chrome_common_apk_or_module_tmpl") {
data_deps += [ "//chrome/android:android_lint" ]
}
# Official builds need the dump_syms binary for symbolizing. This is a small
# binary necessary for debugging official builds. Ensure it is built.
if (is_official_build) {
data_deps += [ "//third_party/breakpad:dump_syms" ]
}
shared_libraries = []
loadable_modules = []
if (android_64bit_target_cpu) {

View file

@ -838,16 +838,12 @@ PrivacySandboxSettingsImpl::GetSiteAccessAllowedStatus(
PrivacySandboxSettingsImpl::Status
PrivacySandboxSettingsImpl::GetPrivacySandboxAllowedStatus(
bool should_ignore_restriction /*=false*/) const {
if (delegate_->IsIncognitoProfile()) {
return Status::kIncognitoProfile;
}
bool should_ignore_restriction /*=false*/) const {
if (delegate_->IsIncognitoProfile()) {
return Status::kIncognitoProfile;
}
if (IsPrivacySandboxRestricted() && !should_ignore_restriction) {
return Status::kRestricted;
}
return Status::kAllowed;
}
PrivacySandboxSettingsImpl::Status

View file

@ -64,7 +64,7 @@ namespace {
// seed over http.
const char kEncryptedMessageLabel[] = "chrome variations";
// TODO(crbug.com/792239): Change this key to a unique VariationsService one,
// TODO(crbug.com/41359527): Change this key to a unique VariationsService one,
// once the matching private key is changed server side.
// Key is used to encrypt headers in seed retrieval requests that happen over
// HTTP connections (when retrying after an unsuccessful HTTPS retrieval
@ -248,7 +248,7 @@ std::unique_ptr<SeedResponse> MaybeImportFirstRunSeed(
// This is a utility which syncs the policy-managed value of
// |prefs::kDeviceVariationsRestrictionsByPolicy| into
// |prefs::kVariationsRestrictionsByPolicy|.
// TODO(crbug.com/1060224): Remove this workaround and implement a better long
// TODO(crbug.com/40121933): Remove this workaround and implement a better long
// term solution.
class DeviceVariationsRestrictionByPolicyApplicator {
public:
@ -298,7 +298,7 @@ class DeviceVariationsRestrictionByPolicyApplicator {
// and saves and retrieve its local state value, then sets
// prefs::kVariationsRestrictParameter with that new value. That's to
// reflect the changes of chromeos policy into the user policy.
// TODO(crbug.com/1060224): Remove that workaround, and make a better long
// TODO(crbug.com/40121933): Remove that workaround, and make a better long
// term solution.
void OnDevicePolicyChange() {
const std::string& device_policy =
@ -437,6 +437,17 @@ bool VariationsService::IsLikelyDogfoodClient() const {
return !restrict_mode.empty();
}
void VariationsService::SetIsLikelyDogfoodClientForTesting(
bool is_dogfood_client) {
// Any non-empty value for the `restrict_mode_` is treated as a dogfood client
// (see above).
if (is_dogfood_client) {
restrict_mode_ = "nonempty";
} else {
restrict_mode_ = std::string();
}
}
GURL VariationsService::GetVariationsServerURL(HttpOptions http_options) {
const bool secure = http_options == USE_HTTPS;
const std::string restrict_mode = GetRestrictParameterValue(
@ -499,7 +510,7 @@ void VariationsService::EnsureLocaleEquals(const std::string& locale) {
// problems in this area may only appear in the wild due to official builds
// and end user machines.
if (locale != field_trial_creator_.application_locale()) {
// TODO(crbug.com/912320): Report the two values in crash keys.
// TODO(crbug.com/41430274): Report the two values in crash keys.
static auto* lhs_key = base::debug::AllocateCrashKeyString(
"mismatched_locale_lhs", base::debug::CrashKeySize::Size256);
static auto* rhs_key = base::debug::AllocateCrashKeyString(
@ -966,7 +977,7 @@ std::vector<StudyGroupNames> VariationsService::GetStudiesAvailableToForce() {
return {};
}
// TODO(crbug.com/1519232): chrome://field-trial-internals will not support
// TODO(crbug.com/41492213): chrome://field-trial-internals will not support
// studies that are constrained to a layer with LIMITED entropy mode before
// limited entropy randomization fully lands.
auto entropy_providers = state_manager_->CreateEntropyProviders(

View file

@ -289,7 +289,8 @@ bool IsAACSupported(const AudioType& type) {
#elif BUILDFLAG(IS_MAC)
return true;
#elif BUILDFLAG(IS_WIN)
return base::win::GetVersion() >= base::win::Version::WIN11_22H2;
return base::win::GetVersion() >= base::win::Version::WIN11_22H2 &&
!base::win::OSInfo::GetInstance()->IsWindowsNSku();
#else
return false;
#endif
@ -341,14 +342,14 @@ bool IsDefaultSupportedVideoType(const VideoType& type) {
? true
: GetSupplementalProfileCache()->IsProfileSupported(
type.profile);
case VideoCodec::kMPEG2:
return true;
case VideoCodec::kAV1:
return IsAV1Supported(type);
case VideoCodec::kVP9:
return IsVp9ProfileSupported(type);
case VideoCodec::kHEVC:
return IsHevcProfileSupported(type);
case VideoCodec::kMPEG2:
return true;
case VideoCodec::kMPEG4:
return IsMPEG4Supported();
case VideoCodec::kDolbyVision:

View file

@ -408,7 +408,9 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
// TODO(dalecurtis): Just use the profile from the codec context if ffmpeg
// ever starts supporting xHE-AAC.
if (codec_context->profile == FF_PROFILE_UNKNOWN) {
// FFmpeg provides the (defined_profile - 1) for AVCodecContext::profile
if (codec_context->profile == FF_PROFILE_UNKNOWN ||
codec_context->profile == mp4::AAC::kXHeAAcType - 1) {
// Errors aren't fatal here, so just drop any MediaLog messages.
NullMediaLog media_log;
mp4::AAC aac_parser;
@ -548,7 +550,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
case VideoCodec::kHEVC: {
int hevc_profile = -1;
// We need to parse extradata each time, because we wont add ffmpeg
// We need to parse extradata each time, because we won't add ffmpeg
// hevc decoder & parser to chromium and codec_context->profile
// should always be FF_PROFILE_UNKNOWN (-99) here
if (codec_context->extradata && codec_context->extradata_size) {
@ -657,6 +659,9 @@ 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
@ -678,18 +683,18 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
}
} else if (codec_context->codec_id == AV_CODEC_ID_H264 &&
codec_context->colorspace == AVCOL_SPC_RGB &&
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt) ==
PIXEL_FORMAT_I420) {
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. Only 4:2:0 formats are checked,
// because GBR is reasonable for 4:4:4 content. See crbug.com/1067377.
// 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.
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) &&
AVPixelFormatToVideoPixelFormat(codec_context->pix_fmt) ==
PIXEL_FORMAT_I420) {
video_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
@ -744,7 +749,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance);
}
// TODO(https://crbug.com/1446302): Consider rejecting metadata that
// TODO(crbug.com/40268540): Consider rejecting metadata that
// does not specify all values.
if (mdcv->has_primaries || mdcv->has_luminance) {
hdr_metadata.smpte_st_2086 = smpte_st_2086;

View file

@ -198,7 +198,7 @@ declare_args() {
# ASAN and TSAN will occasionally hang during pa_context_connect(), so we
# disable PulseAudio when these configurations are enabled.
#
# TODO(crbug.com/986021): We shouldn't have to do this, but it's unclear why
# 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) {
@ -343,7 +343,7 @@ media_subcomponent_deps = [
"//media/audio",
"//media/base",
# TODO(crbug.com/583067): These files should not be in //media/base.
# TODO(crbug.com/41237623): These files should not be in //media/base.
"//media/base/android",
"//media/capabilities",
"//media/cdm",

View file

@ -1,6 +1,6 @@
#!special-case-list-v1
# Copyright 2024 The Chromium Authors, RobRich999, and Alex313031
# TODO(https://crbug.com/1515966): update to glob patterns
# 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.
@ -168,7 +168,7 @@ 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/1511050): See if we can avoid disabling CFI for std::function.
# 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