fix: older systems crash when playing media files (#32046)

* fix: win7 crash when playing media

* reset

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
Micha Hanselmann 2021-12-16 18:23:30 +01:00 коммит произвёл GitHub
Родитель c1b3b3064b
Коммит e9420982d2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 12 добавлений и 16 удалений

Просмотреть файл

@ -59,7 +59,7 @@ index ad366d0fd4c3a637d75a102ab56984f0d01bfc04..d63eb133fd4bab1ea309bb8c742acf88
// 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<SystemMediaControlsNotifier>(
- 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<SystemMediaControlsNotifier>(
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<SystemMediaControlsNotifier>(
+ 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();
}