REGRESSION(r243958): Unnecessary deactivation of AudioSession (PLT Regression)
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2019 23:46:25 +0000 (23:46 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Apr 2019 23:46:25 +0000 (23:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197123
<rdar://problem/49783264>

Reviewed by Per Arne Vollan.

Only set m_becameActive if we actually activated the AudioSession before starting playback. This
avoids unnecessarily deactivating the AudioSession in processWillSuspend().

* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244490 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp

index feb0e0b..2e8d757 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-20  Jer Noble  <jer.noble@apple.com>
+
+        REGRESSION(r243958): Unnecessary deactivation of AudioSession (PLT Regression)
+        https://bugs.webkit.org/show_bug.cgi?id=197123
+        <rdar://problem/49783264>
+
+        Reviewed by Per Arne Vollan.
+
+        Only set m_becameActive if we actually activated the AudioSession before starting playback. This
+        avoids unnecessarily deactivating the AudioSession in processWillSuspend().
+
+        * platform/audio/PlatformMediaSessionManager.cpp:
+        (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
+
 2019-04-19  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: Timelines: CPU: ensure that tracking stops when disconnecting Web Inspector
index 9b0be57..665c38c 100644 (file)
@@ -219,12 +219,15 @@ bool PlatformMediaSessionManager::sessionWillBeginPlayback(PlatformMediaSession&
     }
 
 #if USE(AUDIO_SESSION)
-    if (activeAudioSessionRequired() && !AudioSession::sharedSession().tryToSetActive(true)) {
-        ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier(), " returning false failed to set active AudioSession");
-        return false;
-    }
+    if (activeAudioSessionRequired()) {
+        if (!AudioSession::sharedSession().tryToSetActive(true)) {
+            ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier(), " returning false failed to set active AudioSession");
+            return false;
+        }
 
-    m_becameActive = true;
+        ALWAYS_LOG(LOGIDENTIFIER, session.logIdentifier(), " sucessfully activated AudioSession");
+        m_becameActive = true;
+    }
 #endif
 
     if (m_interrupted)