diff --git a/other/Mac/cdm_registration.cc b/other/Mac/cdm_registration.cc index 13ce10b2..10f03c8f 100644 --- a/other/Mac/cdm_registration.cc +++ b/other/Mac/cdm_registration.cc @@ -47,6 +47,10 @@ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #endif // BUILDFLAG(ENABLE_WIDEVINE) +#if BUILDFLAG(IS_ANDROID) +#include "media/base/android/media_drm_bridge.h" +#endif // BUILDFLAG(IS_ANDROID) + namespace { using Robustness = content::CdmInfo::Robustness; @@ -77,15 +81,17 @@ std::unique_ptr CreateCdmInfoFromWidevineDirectory( auto cdm_library_path = media::GetPlatformSpecificDirectory(cdm_base_path) .Append(base::GetNativeLibraryName(kWidevineCdmLibraryName)); - if (!base::PathExists(cdm_library_path)) + if (!base::PathExists(cdm_library_path)) { return nullptr; + } // Manifest should be at the top level. auto manifest_path = cdm_base_path.Append(FILE_PATH_LITERAL("manifest.json")); base::Version version; media::CdmCapability capability; - if (!ParseCdmManifestFromPath(manifest_path, &version, &capability)) + if (!ParseCdmManifestFromPath(manifest_path, &version, &capability)) { return nullptr; + } return CreateWidevineCdmInfo(version, cdm_library_path, std::move(capability)); @@ -131,8 +137,9 @@ content::CdmInfo* GetComponentUpdatedWidevine() { static base::NoDestructor> s_cdm_info( []() -> std::unique_ptr { auto install_dir = GetLatestComponentUpdatedWidevineCdmDirectory(); - if (install_dir.empty()) + if (install_dir.empty()) { return nullptr; + } return CreateCdmInfoFromWidevineDirectory(install_dir); }()); @@ -142,7 +149,17 @@ content::CdmInfo* GetComponentUpdatedWidevine() { // BUILDFLAG(IS_CHROMEOS)) void AddSoftwareSecureWidevine(std::vector* cdms) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + DVLOG(1) << __func__; + +#if BUILDFLAG(IS_ANDROID) + // On Android Widevine is done by MediaDrm, and should be supported on all + // devices. Register Widevine without any capabilities so that it will be + // checked the first time some page attempts to play protected content. + cdms->push_back(content::CdmInfo(kWidevineKeySystem, + Robustness::kSoftwareSecure, absl::nullopt, + kWidevineCdmType)); + +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) base::Version glibc_version(gnu_get_libc_version()); DCHECK(glibc_version.IsValid()); @@ -193,7 +210,17 @@ void AddSoftwareSecureWidevine(std::vector* cdms) { } void AddHardwareSecureWidevine(std::vector* cdms) { -#if BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) + DVLOG(1) << __func__; + +#if BUILDFLAG(IS_ANDROID) + // On Android Widevine is done by MediaDrm, and should be supported on all + // devices. Register Widevine without any capabilities so that it will be + // checked the first time some page attempts to play protected content. + cdms->push_back(content::CdmInfo(kWidevineKeySystem, + Robustness::kHardwareSecure, absl::nullopt, + kWidevineCdmType)); + +#elif BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) #if BUILDFLAG(IS_CHROMEOS_LACROS) if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kLacrosUseChromeosProtectedMedia)) { @@ -258,10 +285,11 @@ void AddExternalClearKey(std::vector* cdms) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::FilePath clear_key_cdm_path = command_line->GetSwitchValuePath(switches::kClearKeyCdmPathForTesting); - if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) + if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) { return; + } - // Supported codecs are hard-coded in ExternalClearKeySystemInfo. + // Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo. media::CdmCapability capability( {}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs}, {media::CdmSessionType::kTemporary, @@ -286,6 +314,62 @@ void AddExternalClearKey(std::vector* cdms) { } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) +#if BUILDFLAG(IS_WIN) +void AddMediaFoundationClearKey(std::vector* cdms) { + if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) { + return; + } + + // Register MediaFoundation Clear Key CDM if specified in feature list. + base::FilePath clear_key_cdm_path = base::FilePath::FromASCII( + media::kMediaFoundationClearKeyCdmPathForTesting.Get()); + if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) { + return; + } + + // Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo. + media::CdmCapability capability( + {}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs}, + {media::CdmSessionType::kTemporary}); + + cdms->push_back( + content::CdmInfo(media::kMediaFoundationClearKeyKeySystem, + Robustness::kHardwareSecure, capability, + /*supports_sub_key_systems=*/false, + media::kMediaFoundationClearKeyCdmDisplayName, + media::kMediaFoundationClearKeyCdmType, + base::Version("0.1.0.0"), clear_key_cdm_path)); +} +#endif // BUILDFLAG(IS_WIN) + +#if BUILDFLAG(IS_ANDROID) +void AddOtherAndroidKeySystems(std::vector* cdms) { + // CdmInfo needs a CdmType, but on Android it is not used as the key system + // is supported by MediaDrm. Using a random value as something needs to be + // specified, but must be different than other CdmTypes specified. + // (On Android the key system is identified by UUID, and that mapping is + // maintained by MediaDrmBridge.) + const media::CdmType kAndroidCdmType{0x2e9dabb9c171c28cull, + 0xf455252ec70b52adull}; + + // MediaDrmBridge returns a list of key systems available on the device + // that are not Widevine. Register them with no capabilities specified so + // that lazy evaluation can figure out what is supported when requested. + // We don't know if either software secure or hardware secure support is + // available, so register them both. Lazy evaluation will remove them + // if they aren't supported. + const auto key_system_names = + media::MediaDrmBridge::GetPlatformKeySystemNames(); + for (const auto& key_system : key_system_names) { + DVLOG(3) << __func__ << " key_system:" << key_system; + cdms->push_back(content::CdmInfo(key_system, Robustness::kSoftwareSecure, + absl::nullopt, kAndroidCdmType)); + cdms->push_back(content::CdmInfo(key_system, Robustness::kHardwareSecure, + absl::nullopt, kAndroidCdmType)); + } +} +#endif // BUILDFLAG(IS_ANDROID) + } // namespace void RegisterCdmInfo(std::vector* cdms) { @@ -300,4 +384,14 @@ void RegisterCdmInfo(std::vector* cdms) { #if BUILDFLAG(ENABLE_LIBRARY_CDMS) AddExternalClearKey(cdms); #endif + +#if BUILDFLAG(IS_WIN) + AddMediaFoundationClearKey(cdms); +#endif + +#if BUILDFLAG(IS_ANDROID) + AddOtherAndroidKeySystems(cdms); +#endif // BUILDFLAG(IS_ANDROID) + + DVLOG(3) << __func__ << " done with " << cdms->size() << " cdms"; } diff --git a/src/chrome/BUILD.gn b/src/chrome/BUILD.gn index 05b2321c..37d7ff18 100644 --- a/src/chrome/BUILD.gn +++ b/src/chrome/BUILD.gn @@ -196,6 +196,7 @@ if (!is_android && !is_mac) { "//base", "//build:branding_buildflags", "//chrome/app:chrome_exe_main_exports", + "//chrome/app:exit_code_watcher", "//chrome/app/version_assembly:chrome_exe_manifest", "//chrome/browser:active_use_util", "//chrome/browser:chrome_process_finder", @@ -206,7 +207,6 @@ if (!is_android && !is_mac) { "//chrome/install_static:secondary_module", "//chrome/installer/util:constants", "//chrome/installer/util:did_run_support", - "//components/browser_watcher:browser_watcher_client", "//components/crash/core/app", "//components/crash/core/app:run_as_crashpad_handler", "//components/crash/core/common", @@ -388,6 +388,7 @@ if (is_win) { configs += [ "//build/config/compiler:wexit_time_destructors" ] configs -= [ "//build/config/compiler:thinlto_optimize_default" ] configs += [ "//build/config/compiler:thinlto_optimize_max" ] + defines = [] sources = [ @@ -412,7 +413,6 @@ if (is_win) { "//chrome/common/profiler", "//chrome/install_static:install_static_util", "//chrome/install_static:secondary_module", - "//components/browser_watcher:stability_client", "//components/crash/core/app", "//components/policy:generated", "//content/public/app", diff --git a/src/chrome/common/media/cdm_registration.cc b/src/chrome/common/media/cdm_registration.cc index 13ce10b2..10f03c8f 100644 --- a/src/chrome/common/media/cdm_registration.cc +++ b/src/chrome/common/media/cdm_registration.cc @@ -47,6 +47,10 @@ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #endif // BUILDFLAG(ENABLE_WIDEVINE) +#if BUILDFLAG(IS_ANDROID) +#include "media/base/android/media_drm_bridge.h" +#endif // BUILDFLAG(IS_ANDROID) + namespace { using Robustness = content::CdmInfo::Robustness; @@ -77,15 +81,17 @@ std::unique_ptr CreateCdmInfoFromWidevineDirectory( auto cdm_library_path = media::GetPlatformSpecificDirectory(cdm_base_path) .Append(base::GetNativeLibraryName(kWidevineCdmLibraryName)); - if (!base::PathExists(cdm_library_path)) + if (!base::PathExists(cdm_library_path)) { return nullptr; + } // Manifest should be at the top level. auto manifest_path = cdm_base_path.Append(FILE_PATH_LITERAL("manifest.json")); base::Version version; media::CdmCapability capability; - if (!ParseCdmManifestFromPath(manifest_path, &version, &capability)) + if (!ParseCdmManifestFromPath(manifest_path, &version, &capability)) { return nullptr; + } return CreateWidevineCdmInfo(version, cdm_library_path, std::move(capability)); @@ -131,8 +137,9 @@ content::CdmInfo* GetComponentUpdatedWidevine() { static base::NoDestructor> s_cdm_info( []() -> std::unique_ptr { auto install_dir = GetLatestComponentUpdatedWidevineCdmDirectory(); - if (install_dir.empty()) + if (install_dir.empty()) { return nullptr; + } return CreateCdmInfoFromWidevineDirectory(install_dir); }()); @@ -142,7 +149,17 @@ content::CdmInfo* GetComponentUpdatedWidevine() { // BUILDFLAG(IS_CHROMEOS)) void AddSoftwareSecureWidevine(std::vector* cdms) { -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + DVLOG(1) << __func__; + +#if BUILDFLAG(IS_ANDROID) + // On Android Widevine is done by MediaDrm, and should be supported on all + // devices. Register Widevine without any capabilities so that it will be + // checked the first time some page attempts to play protected content. + cdms->push_back(content::CdmInfo(kWidevineKeySystem, + Robustness::kSoftwareSecure, absl::nullopt, + kWidevineCdmType)); + +#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) base::Version glibc_version(gnu_get_libc_version()); DCHECK(glibc_version.IsValid()); @@ -193,7 +210,17 @@ void AddSoftwareSecureWidevine(std::vector* cdms) { } void AddHardwareSecureWidevine(std::vector* cdms) { -#if BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) + DVLOG(1) << __func__; + +#if BUILDFLAG(IS_ANDROID) + // On Android Widevine is done by MediaDrm, and should be supported on all + // devices. Register Widevine without any capabilities so that it will be + // checked the first time some page attempts to play protected content. + cdms->push_back(content::CdmInfo(kWidevineKeySystem, + Robustness::kHardwareSecure, absl::nullopt, + kWidevineCdmType)); + +#elif BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA) #if BUILDFLAG(IS_CHROMEOS_LACROS) if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kLacrosUseChromeosProtectedMedia)) { @@ -258,10 +285,11 @@ void AddExternalClearKey(std::vector* cdms) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::FilePath clear_key_cdm_path = command_line->GetSwitchValuePath(switches::kClearKeyCdmPathForTesting); - if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) + if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) { return; + } - // Supported codecs are hard-coded in ExternalClearKeySystemInfo. + // Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo. media::CdmCapability capability( {}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs}, {media::CdmSessionType::kTemporary, @@ -286,6 +314,62 @@ void AddExternalClearKey(std::vector* cdms) { } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) +#if BUILDFLAG(IS_WIN) +void AddMediaFoundationClearKey(std::vector* cdms) { + if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) { + return; + } + + // Register MediaFoundation Clear Key CDM if specified in feature list. + base::FilePath clear_key_cdm_path = base::FilePath::FromASCII( + media::kMediaFoundationClearKeyCdmPathForTesting.Get()); + if (clear_key_cdm_path.empty() || !base::PathExists(clear_key_cdm_path)) { + return; + } + + // Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo. + media::CdmCapability capability( + {}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs}, + {media::CdmSessionType::kTemporary}); + + cdms->push_back( + content::CdmInfo(media::kMediaFoundationClearKeyKeySystem, + Robustness::kHardwareSecure, capability, + /*supports_sub_key_systems=*/false, + media::kMediaFoundationClearKeyCdmDisplayName, + media::kMediaFoundationClearKeyCdmType, + base::Version("0.1.0.0"), clear_key_cdm_path)); +} +#endif // BUILDFLAG(IS_WIN) + +#if BUILDFLAG(IS_ANDROID) +void AddOtherAndroidKeySystems(std::vector* cdms) { + // CdmInfo needs a CdmType, but on Android it is not used as the key system + // is supported by MediaDrm. Using a random value as something needs to be + // specified, but must be different than other CdmTypes specified. + // (On Android the key system is identified by UUID, and that mapping is + // maintained by MediaDrmBridge.) + const media::CdmType kAndroidCdmType{0x2e9dabb9c171c28cull, + 0xf455252ec70b52adull}; + + // MediaDrmBridge returns a list of key systems available on the device + // that are not Widevine. Register them with no capabilities specified so + // that lazy evaluation can figure out what is supported when requested. + // We don't know if either software secure or hardware secure support is + // available, so register them both. Lazy evaluation will remove them + // if they aren't supported. + const auto key_system_names = + media::MediaDrmBridge::GetPlatformKeySystemNames(); + for (const auto& key_system : key_system_names) { + DVLOG(3) << __func__ << " key_system:" << key_system; + cdms->push_back(content::CdmInfo(key_system, Robustness::kSoftwareSecure, + absl::nullopt, kAndroidCdmType)); + cdms->push_back(content::CdmInfo(key_system, Robustness::kHardwareSecure, + absl::nullopt, kAndroidCdmType)); + } +} +#endif // BUILDFLAG(IS_ANDROID) + } // namespace void RegisterCdmInfo(std::vector* cdms) { @@ -300,4 +384,14 @@ void RegisterCdmInfo(std::vector* cdms) { #if BUILDFLAG(ENABLE_LIBRARY_CDMS) AddExternalClearKey(cdms); #endif + +#if BUILDFLAG(IS_WIN) + AddMediaFoundationClearKey(cdms); +#endif + +#if BUILDFLAG(IS_ANDROID) + AddOtherAndroidKeySystems(cdms); +#endif // BUILDFLAG(IS_ANDROID) + + DVLOG(3) << __func__ << " done with " << cdms->size() << " cdms"; } diff --git a/src/media/base/media_switches.cc b/src/media/base/media_switches.cc index f1526f44..ad6ea066 100644 --- a/src/media/base/media_switches.cc +++ b/src/media/base/media_switches.cc @@ -116,6 +116,8 @@ const char kAudioCapturerWithEchoCancellation[] = #if defined(USE_CRAS) // Use CRAS, the ChromeOS audio server. const char kUseCras[] = "use-cras"; +// Enforce system audio echo cancellation. +const char kSystemAecEnabled[] = "system-aec-enabled"; #endif // defined(USE_CRAS) // For automated testing of protected content, this switch allows specific @@ -601,11 +603,6 @@ BASE_FEATURE(kGlobalMediaControlsAutoDismiss, BASE_FEATURE(kGlobalMediaControlsCrOSUpdatedUI, "GlobalMediaControlsCrOSUpdatedUI", base::FEATURE_ENABLED_BY_DEFAULT); - -// Show Cast sessions in Global Media Controls. -BASE_FEATURE(kGlobalMediaControlsForCast, - "GlobalMediaControlsForCast", - base::FEATURE_ENABLED_BY_DEFAULT); #endif #if !BUILDFLAG(IS_ANDROID) @@ -768,7 +765,7 @@ BASE_FEATURE(kVp9kSVCHWDecoding, #if BUILDFLAG(IS_CHROMEOS) base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif ); @@ -787,6 +784,12 @@ BASE_FEATURE(kExternalClearKeyForTesting, "ExternalClearKeyForTesting", base::FEATURE_DISABLED_BY_DEFAULT); +#if BUILDFLAG(IS_WIN) +// Specifies the path to the MediaFoundation Clear Key CDM for testing. +const base::FeatureParam kMediaFoundationClearKeyCdmPathForTesting{ + &kExternalClearKeyForTesting, "media_foundation_cdm_path", ""}; +#endif // BUILDFLAG(IS_WIN) + // Enables the Live Caption feature on supported devices. BASE_FEATURE(kLiveCaption, "LiveCaption", base::FEATURE_ENABLED_BY_DEFAULT); @@ -859,7 +862,7 @@ const base::FeatureParam kHardwareSecureDecryptionForceSupportClearLead{ // sub key systems. Which sub key system is experimental is key system specific. BASE_FEATURE(kHardwareSecureDecryptionExperiment, "HardwareSecureDecryptionExperiment", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Allows automatically disabling hardware secure Content Decryption Module // (CDM) after failures or crashes to fallback to software secure CDMs. If this @@ -876,6 +879,12 @@ const base::FeatureParam kHardwareSecureDecryptionFallbackMinDisablingDays{ const base::FeatureParam kHardwareSecureDecryptionFallbackMaxDisablingDays{ &kHardwareSecureDecryptionFallback, "max_disabling_days", 180}; +// Whether selected HardwareContextReset events should be considered as failures +// in the hardware secure decryption fallback logic. +const base::FeatureParam + kHardwareSecureDecryptionFallbackOnHardwareContextReset{ + &kHardwareSecureDecryptionFallback, "on_hardware_context_reset", true}; + BASE_FEATURE(kWakeLockOptimisationHiddenMuted, "kWakeLockOptimisationHiddenMuted", base::FEATURE_ENABLED_BY_DEFAULT); @@ -1042,6 +1051,11 @@ BASE_FEATURE(kLimitConcurrentDecoderInstances, "LimitConcurrentDecoderInstances", base::FEATURE_ENABLED_BY_DEFAULT); +// Use SequencedTaskRunner for VideoEncodeAccelerator +BASE_FEATURE(kUSeSequencedTaskRunnerForVEA, + "UseSequencedTaskRunnerForVEA", + base::FEATURE_DISABLED_BY_DEFAULT); + #if defined(ARCH_CPU_ARM_FAMILY) // Experimental support for GL based image processing. On some architectures, // the hardware accelerated video decoder outputs frames in a format not @@ -1122,6 +1136,11 @@ BASE_FEATURE(kD3D11Vp9kSVCHWDecoding, "D3D11Vp9kSVCHWDecoding", base::FEATURE_ENABLED_BY_DEFAULT); +// Controls whether the DXVA video decoder is enabled on Windows. +BASE_FEATURE(kDXVAVideoDecoding, + "DXVAVideoDecoding", + base::FEATURE_DISABLED_BY_DEFAULT); + // The Media Foundation Rendering Strategy determines which presentation mode // Media Foundation Renderer should use for presenting clear content. This // strategy has no impact for protected content, which must always use Direct @@ -1154,7 +1173,7 @@ constexpr base::FeatureParam::Option const base::FeatureParam kMediaFoundationClearRenderingStrategyParam{ &kMediaFoundationClearRendering, "strategy", - MediaFoundationClearRenderingStrategy::kDirectComposition, + MediaFoundationClearRenderingStrategy::kDynamic, &kMediaFoundationClearRenderingStrategyOptions}; BASE_FEATURE(kMediaFoundationBatchRead, @@ -1204,7 +1223,17 @@ const base::Feature MEDIA_EXPORT kUseOutOfProcessVideoEncoding{ // doesn't affect the PPB_VideoDecoder_Impl which will continue to use the // GpuVideoDecodeAcceleratorHost for the PPB_VideoDecoder_Dev interface. const base::Feature MEDIA_EXPORT kUseMojoVideoDecoderForPepper{ - "UseMojoVideoDecoderForPepper", base::FEATURE_DISABLED_BY_DEFAULT}; + "UseMojoVideoDecoderForPepper", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Use SequencedTaskRunner for MediaService. +BASE_FEATURE(kUseSequencedTaskRunnerForMediaService, + "UseSequencedTaskRunnerForMediaService", + base::FEATURE_DISABLED_BY_DEFAULT); + +// Use SequencedTaskRunner for MojoVideoEncodeAcceleratorProvider. +BASE_FEATURE(kUseSequencedTaskRunnerForMojoVEAProvider, + "UseSequencedTaskRunnerForMojoVEAProvider", + base::FEATURE_DISABLED_BY_DEFAULT); std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) { // Return the autoplay policy set in the command line, if any. diff --git a/src/media/gpu/ipc/service/gpu_video_decode_accelerator.cc b/src/media/gpu/ipc/service/gpu_video_decode_accelerator.cc index 5f552ed9..ed946542 100644 --- a/src/media/gpu/ipc/service/gpu_video_decode_accelerator.cc +++ b/src/media/gpu/ipc/service/gpu_video_decode_accelerator.cc @@ -60,7 +60,7 @@ static bool MakeDecoderContextCurrent( return true; } -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) static bool BindDecoderManagedImage( const base::WeakPtr& stub, uint32_t client_texture_id, @@ -299,10 +299,10 @@ GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator( base::BindRepeating(&GetGLContext, stub_->AsWeakPtr()); gl_client_.make_context_current = base::BindRepeating(&MakeDecoderContextCurrent, stub_->AsWeakPtr()); - // The semantics of |bind_image| vary per-platform: On Windows and Mac it must - // mark the image as needing binding by the decoder, while on other platforms - // it must mark the image as *not* needing binding by the decoder. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) + // The semantics of |bind_image| vary per-platform: On Windows and Apple it + // must mark the image as needing binding by the decoder, while on other + // platforms it must mark the image as *not* needing binding by the decoder. +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) gl_client_.bind_image = base::BindRepeating(&BindDecoderManagedImage, stub_->AsWeakPtr()); #else @@ -490,7 +490,7 @@ bool GpuVideoDecodeAccelerator::Initialize( // Attempt to set up performing decoding tasks on IO thread, if supported by // the VDA. bool decode_on_io = - video_decode_accelerator_->TryToSetupDecodeOnSeparateThread( + video_decode_accelerator_->TryToSetupDecodeOnSeparateSequence( weak_factory_for_io_.GetWeakPtr(), io_task_runner_); // Bind the receiver on the IO thread. We wait here for it to be bound @@ -500,7 +500,7 @@ bool GpuVideoDecodeAccelerator::Initialize( return filter_->Bind(std::move(receiver), io_task_runner_); } -// Runs on IO thread if VDA::TryToSetupDecodeOnSeparateThread() succeeded, +// Runs on IO thread if VDA::TryToSetupDecodeOnSeparateSequence() succeeded, // otherwise on the main thread. void GpuVideoDecodeAccelerator::OnDecode(BitstreamBuffer bitstream_buffer) { DCHECK(video_decode_accelerator_); diff --git a/src/media/gpu/vaapi/vaapi_video_decode_accelerator.cc b/src/media/gpu/vaapi/vaapi_video_decode_accelerator.cc index e51e6b64..a04386f9 100644 --- a/src/media/gpu/vaapi/vaapi_video_decode_accelerator.cc +++ b/src/media/gpu/vaapi/vaapi_video_decode_accelerator.cc @@ -22,13 +22,13 @@ #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/synchronization/waitable_event.h" +#include "base/task/bind_post_task.h" #include "base/task/single_thread_task_runner.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "gpu/ipc/service/gpu_channel.h" -#include "media/base/bind_to_current_loop.h" #include "media/base/format_utils.h" #include "media/base/media_log.h" #include "media/base/video_util.h" @@ -165,8 +165,9 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( bind_image_cb_(bind_image_cb), weak_this_factory_(this) { weak_this_ = weak_this_factory_.GetWeakPtr(); - va_surface_recycle_cb_ = BindToCurrentLoop(base::BindRepeating( - &VaapiVideoDecodeAccelerator::RecycleVASurface, weak_this_)); + va_surface_recycle_cb_ = + base::BindPostTaskToCurrentDefault(base::BindRepeating( + &VaapiVideoDecodeAccelerator::RecycleVASurface, weak_this_)); base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( this, "media::VaapiVideoDecodeAccelerator", base::SingleThreadTaskRunner::GetCurrentDefault()); @@ -344,7 +345,7 @@ void VaapiVideoDecodeAccelerator::QueueInputBuffer( } else { auto input_buffer = std::make_unique( bitstream_id, std::move(buffer), - BindToCurrentLoop( + base::BindPostTaskToCurrentDefault( base::BindOnce(&Client::NotifyEndOfBitstreamBuffer, client_))); input_buffers_.push(std::move(input_buffer)); } @@ -1086,9 +1087,9 @@ void VaapiVideoDecodeAccelerator::Destroy() { delete this; } -bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( +bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateSequence( const base::WeakPtr& decode_client, - const scoped_refptr& decode_task_runner) { + const scoped_refptr& decode_task_runner) { return false; } diff --git a/src/media/gpu/vaapi/vaapi_video_decode_accelerator.h b/src/media/gpu/vaapi/vaapi_video_decode_accelerator.h index 8762a4c7..5b31c075 100644 --- a/src/media/gpu/vaapi/vaapi_video_decode_accelerator.h +++ b/src/media/gpu/vaapi/vaapi_video_decode_accelerator.h @@ -88,9 +88,9 @@ class MEDIA_GPU_EXPORT VaapiVideoDecodeAccelerator void Flush() override; void Reset() override; void Destroy() override; - bool TryToSetupDecodeOnSeparateThread( + bool TryToSetupDecodeOnSeparateSequence( const base::WeakPtr& decode_client, - const scoped_refptr& decode_task_runner) + const scoped_refptr& decode_task_runner) override; static VideoDecodeAccelerator::SupportedProfiles GetSupportedProfiles(); diff --git a/src/net/dns/dns_client.cc b/src/net/dns/dns_client.cc index 208112eb..933d9e5c 100644 --- a/src/net/dns/dns_client.cc +++ b/src/net/dns/dns_client.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2023 The Chromium Authors and Alex313031. +// Copyright 2023 The Chromium Authors and Alex313031 // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/src/net/url_request/url_request_http_job.cc b/src/net/url_request/url_request_http_job.cc index 5c3410e4..33d483d1 100644 --- a/src/net/url_request/url_request_http_job.cc +++ b/src/net/url_request/url_request_http_job.cc @@ -278,6 +278,15 @@ void URLRequestHttpJob::Start() { request_info_.reporting_upload_depth = request_->reporting_upload_depth(); #endif + // Add/remove the Storage Access override enum based on whether the request's + // url and initiator are same-site, to prevent cross-site sibling iframes + // benefit from each other's storage access API grants. + request()->cookie_setting_overrides().PutOrRemove( + net::CookieSettingOverride::kStorageAccessGrantEligible, + request()->has_storage_access() && request_initiator_site().has_value() && + request_initiator_site().value() == + net::SchemefulSite(request()->url())); + bool should_add_cookie_header = ShouldAddCookieHeader(); UMA_HISTOGRAM_BOOLEAN("Net.HttpJob.CanIncludeCookies", should_add_cookie_header);