Title: [280698] trunk/Source/WebKit
Revision
280698
Author
[email protected]
Date
2021-08-05 10:05:58 -0700 (Thu, 05 Aug 2021)

Log Message

[GPUP] RemoteAudioSessionProxyManager should use the shared audio session
https://bugs.webkit.org/show_bug.cgi?id=228795
<rdar://problem/81530450>

Reviewed by Jer Noble.

RemoteAudioSessionProxyManager creates and uses a private AudioSession, which means
that any code that moves from the WebProcess to the GPUProcess and uses
`AudioSession::sharedSession` will be using a separate platform audio session wrapper
object. RemoteAudioSessionProxyManager doesn't need a private AudioSession, so
change it to use `AudioSession::sharedSession`.

* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager): Don't
create a new AudioSession.
(WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager): Use
AudioSession::sharedSession().
(WebKit::RemoteAudioSessionProxyManager::updateCategory): Ditto.
(WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess): Ditto.
(WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (280697 => 280698)


--- trunk/Source/WebKit/ChangeLog	2021-08-05 16:44:10 UTC (rev 280697)
+++ trunk/Source/WebKit/ChangeLog	2021-08-05 17:05:58 UTC (rev 280698)
@@ -1,3 +1,26 @@
+2021-08-05  Eric Carlson  <[email protected]>
+
+        [GPUP] RemoteAudioSessionProxyManager should use the shared audio session
+        https://bugs.webkit.org/show_bug.cgi?id=228795
+        <rdar://problem/81530450>
+
+        Reviewed by Jer Noble.
+
+        RemoteAudioSessionProxyManager creates and uses a private AudioSession, which means
+        that any code that moves from the WebProcess to the GPUProcess and uses
+        `AudioSession::sharedSession` will be using a separate platform audio session wrapper
+        object. RemoteAudioSessionProxyManager doesn't need a private AudioSession, so 
+        change it to use `AudioSession::sharedSession`.
+
+        * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
+        (WebKit::RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager): Don't
+        create a new AudioSession.
+        (WebKit::RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager): Use
+        AudioSession::sharedSession().
+        (WebKit::RemoteAudioSessionProxyManager::updateCategory): Ditto.
+        (WebKit::RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess): Ditto.
+        (WebKit::RemoteAudioSessionProxyManager::tryToSetActiveForProcess): Ditto.
+
 2021-08-05  Wenson Hsieh  <[email protected]>
 
         [macOS Monterey] Translate popover becomes detached from webpage after scrolling

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp (280697 => 280698)


--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp	2021-08-05 16:44:10 UTC (rev 280697)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp	2021-08-05 17:05:58 UTC (rev 280698)
@@ -44,16 +44,15 @@
 }
 
 RemoteAudioSessionProxyManager::RemoteAudioSessionProxyManager()
-    : m_session(AudioSession::create())
 {
-    m_session->addInterruptionObserver(*this);
-    m_session->addConfigurationChangeObserver(*this);
+    AudioSession::sharedSession().addInterruptionObserver(*this);
+    AudioSession::sharedSession().addConfigurationChangeObserver(*this);
 }
 
 RemoteAudioSessionProxyManager::~RemoteAudioSessionProxyManager()
 {
-    m_session->removeInterruptionObserver(*this);
-    m_session->removeConfigurationChangeObserver(*this);
+    AudioSession::sharedSession().removeInterruptionObserver(*this);
+    AudioSession::sharedSession().removeConfigurationChangeObserver(*this);
 }
 
 void RemoteAudioSessionProxyManager::addProxy(RemoteAudioSessionProxy& proxy)
@@ -105,7 +104,7 @@
     else if (policyCounts.contains(RouteSharingPolicy::Independent))
         ASSERT_NOT_REACHED();
 
-    m_session->setCategory(category, policy);
+    AudioSession::sharedSession().setCategory(category, policy);
 }
 
 void RemoteAudioSessionProxyManager::setPreferredBufferSizeForProcess(RemoteAudioSessionProxy& proxy, size_t preferredBufferSize)
@@ -115,7 +114,7 @@
             preferredBufferSize = otherProxy.preferredBufferSize();
     }
 
-    m_session->setPreferredBufferSize(preferredBufferSize);
+    AudioSession::sharedSession().setPreferredBufferSize(preferredBufferSize);
 }
 
 bool RemoteAudioSessionProxyManager::tryToSetActiveForProcess(RemoteAudioSessionProxy& proxy, bool active)
@@ -138,13 +137,13 @@
         // This proxy wants to de-activate, and is the last remaining active
         // proxy. Deactivate the session, and return whether that deactivation
         // was sucessful;
-        return m_session->tryToSetActive(false);
+        return AudioSession::sharedSession().tryToSetActive(false);
     }
 
     if (active && !activeProxyCount) {
         // This proxy and only this proxy wants to become active. Activate
         // the session, and return whether that activation was successful.
-        return m_session->tryToSetActive(active);
+        return AudioSession::sharedSession().tryToSetActive(active);
     }
 
     // If this proxy is Ambient, and the session is already active, this

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h (280697 => 280698)


--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h	2021-08-05 16:44:10 UTC (rev 280697)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h	2021-08-05 17:05:58 UTC (rev 280698)
@@ -52,8 +52,8 @@
 
     bool tryToSetActiveForProcess(RemoteAudioSessionProxy&, bool);
 
-    WebCore::AudioSession& session() { return m_session; }
-    const WebCore::AudioSession& session() const { return m_session; }
+    WebCore::AudioSession& session() { return WebCore::AudioSession::sharedSession(); }
+    const WebCore::AudioSession& session() const { return WebCore::AudioSession::sharedSession(); }
 
 private:
     void beginAudioSessionInterruption() final;
@@ -64,7 +64,6 @@
     void sampleRateDidChange(const WebCore::AudioSession&) final;
     void configurationDidChange(const WebCore::AudioSession&);
 
-    UniqueRef<WebCore::AudioSession> m_session;
     WeakHashSet<RemoteAudioSessionProxy> m_proxies;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to