From 952994c591ac2326eaeeb878e633c1b4b5ed202f Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Fri, 17 Dec 2021 13:30:03 -0800 Subject: [PATCH] fix: older systems crash when playing media files (#32213) * fix: win7 crash when playing media * reset * chore: update patches Co-authored-by: Micha Hanselmann Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --- ...media_key_usage_with_globalshortcuts.patch | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/patches/chromium/fix_media_key_usage_with_globalshortcuts.patch b/patches/chromium/fix_media_key_usage_with_globalshortcuts.patch index 92e96b43b0625..4249a08bf26e9 100644 --- a/patches/chromium/fix_media_key_usage_with_globalshortcuts.patch +++ b/patches/chromium/fix_media_key_usage_with_globalshortcuts.patch @@ -59,7 +59,7 @@ index 9aec54a3263d24491d24013a80b719dfc834ecd4..001a6cb2a5eb701351fa924109b43fab // true if register successfully, or false if 1) the specificied |accelerator| // has been registered by another caller or other native applications, or diff --git a/content/browser/media/media_keys_listener_manager_impl.cc b/content/browser/media/media_keys_listener_manager_impl.cc -index 5938f75742b793868638e693a9a8c8dc686dfc46..1137ea6c6b2b14f912b400e3cc43dc6fd0243407 100644 +index 5938f75742b793868638e693a9a8c8dc686dfc46..7f30f3fdd2c63612232e31c331b26b17ad729efb 100644 --- a/content/browser/media/media_keys_listener_manager_impl.cc +++ b/content/browser/media/media_keys_listener_manager_impl.cc @@ -55,7 +55,12 @@ bool MediaKeysListenerManagerImpl::StartWatchingMediaKey( @@ -76,32 +76,28 @@ index 5938f75742b793868638e693a9a8c8dc686dfc46..1137ea6c6b2b14f912b400e3cc43dc6f !media_keys_listener_->StartWatchingMediaKey(key_code)) { return false; } -@@ -231,18 +236,16 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() { - media::AudioManager::GetGlobalAppName()); +@@ -232,18 +237,18 @@ void MediaKeysListenerManagerImpl::StartListeningForMediaKeysIfNecessary() { #endif -- if (system_media_controls_) { -- system_media_controls_->AddObserver(this); -- system_media_controls_notifier_ = -- std::make_unique( -- system_media_controls_.get()); + if (system_media_controls_) { ++ // This is required for proper functioning of MediaMetadata. + system_media_controls_->AddObserver(this); + system_media_controls_notifier_ = + std::make_unique( + system_media_controls_.get()); - } else { - // If we can't access system media controls, then directly listen for media - // key keypresses instead. - media_keys_listener_ = ui::MediaKeysListener::Create( - this, ui::MediaKeysListener::Scope::kGlobal); - DCHECK(media_keys_listener_); -- } -+ // This is required for proper functioning of MediaMetadata. -+ system_media_controls_->AddObserver(this); -+ system_media_controls_notifier_ = -+ std::make_unique( -+ system_media_controls_.get()); -+ + } + + // Directly listen for media key keypresses when using GlobalShortcuts. + media_keys_listener_ = ui::MediaKeysListener::Create( + this, ui::MediaKeysListener::Scope::kGlobal); + DCHECK(media_keys_listener_); - ++ EnsureAuxiliaryServices(); } +