Title: [267929] trunk/Source/WebKit
Revision
267929
Author
[email protected]
Date
2020-10-03 10:26:55 -0700 (Sat, 03 Oct 2020)

Log Message

[Media in GPU Process] Web process is not allowed to set the AudioSession category
https://bugs.webkit.org/show_bug.cgi?id=217236

Reviewed by Eric Carlson.

We disabled setting the audio session category in the Web process when media is playing
in the GPU Process (r257367). But since RemoteAudioSession and RemoteAudioSessionProxy
are working now in the Web process and GPU process, we need to allow setting the audio
session category in the Web process.

This patch also includes an optimization to reduce the IPC traffic of the audio session
category changes.

* GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::setCategory):
* GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
We need to check the category and policy in RemoteAudioSessionProxy instead of
RemoteAudioSessionProxyManager. Otherwise, the change will be ignored.

* WebProcess/GPU/media/RemoteAudioSession.cpp:
(WebKit::RemoteAudioSession::setCategory):
Only send RemoteAudioSessionProxy::SetCategory message if the category or the policy
is changed.
* WebProcess/GPU/media/RemoteAudioSession.h:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
Revert the change in r257367.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (267928 => 267929)


--- trunk/Source/WebKit/ChangeLog	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/ChangeLog	2020-10-03 17:26:55 UTC (rev 267929)
@@ -1,3 +1,35 @@
+2020-10-03  Peng Liu  <[email protected]>
+
+        [Media in GPU Process] Web process is not allowed to set the AudioSession category
+        https://bugs.webkit.org/show_bug.cgi?id=217236
+
+        Reviewed by Eric Carlson.
+
+        We disabled setting the audio session category in the Web process when media is playing
+        in the GPU Process (r257367). But since RemoteAudioSession and RemoteAudioSessionProxy
+        are working now in the Web process and GPU process, we need to allow setting the audio
+        session category in the Web process.
+
+        This patch also includes an optimization to reduce the IPC traffic of the audio session
+        category changes.
+
+        * GPUProcess/media/RemoteAudioSessionProxy.cpp:
+        (WebKit::RemoteAudioSessionProxy::setCategory):
+        * GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
+        (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess):
+        We need to check the category and policy in RemoteAudioSessionProxy instead of
+        RemoteAudioSessionProxyManager. Otherwise, the change will be ignored.
+
+        * WebProcess/GPU/media/RemoteAudioSession.cpp:
+        (WebKit::RemoteAudioSession::setCategory):
+        Only send RemoteAudioSessionProxy::SetCategory message if the category or the policy
+        is changed.
+        * WebProcess/GPU/media/RemoteAudioSession.h:
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::m_limitsNavigationsToAppBoundDomains):
+        Revert the change in r257367.
+
 2020-10-02  Carlos Garcia Campos  <[email protected]>
 
         WebDriver: add support for same site cookies

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp (267928 => 267929)


--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp	2020-10-03 17:26:55 UTC (rev 267929)
@@ -73,6 +73,9 @@
 
 void RemoteAudioSessionProxy::setCategory(AudioSession::CategoryType category, RouteSharingPolicy policy)
 {
+    if (m_category == category && m_routeSharingPolicy == policy)
+        return;
+
     m_category = category;
     m_routeSharingPolicy = policy;
     audioSessionManager().setCategoryForProcess(*this, category, policy);

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp (267928 => 267929)


--- trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp	2020-10-03 17:26:55 UTC (rev 267929)
@@ -68,9 +68,6 @@
 
 void RemoteAudioSessionProxyManager::setCategoryForProcess(RemoteAudioSessionProxy& proxy, AudioSession::CategoryType category, RouteSharingPolicy policy)
 {
-    if (proxy.category() == category && proxy.routeSharingPolicy() == policy)
-        return;
-
     HashCountedSet<AudioSession::CategoryType, WTF::IntHash<AudioSession::CategoryType>, WTF::StrongEnumHashTraits<AudioSession::CategoryType>> categoryCounts;
     HashCountedSet<RouteSharingPolicy, WTF::IntHash<RouteSharingPolicy>, WTF::StrongEnumHashTraits<RouteSharingPolicy>> policyCounts;
     for (auto& otherProxy : m_proxies) {

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp (267928 => 267929)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.cpp	2020-10-03 17:26:55 UTC (rev 267929)
@@ -65,7 +65,12 @@
 
 void RemoteAudioSession::setCategory(CategoryType type, RouteSharingPolicy policy)
 {
-    connection().send(Messages::RemoteAudioSessionProxy::SetCategory(type, policy), { });
+    if (type == m_category && policy == m_routeSharingPolicy)
+        return;
+
+    m_category = type;
+    m_routeSharingPolicy = policy;
+    connection().send(Messages::RemoteAudioSessionProxy::SetCategory(m_category, m_routeSharingPolicy), { });
 }
 
 void RemoteAudioSession::setPreferredBufferSize(size_t size)

Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h (267928 => 267929)


--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteAudioSession.h	2020-10-03 17:26:55 UTC (rev 267929)
@@ -76,6 +76,8 @@
 
     WebProcess& m_process;
     RemoteAudioSessionConfiguration m_configuration;
+    WebCore::AudioSession::CategoryType m_category;
+    WebCore::RouteSharingPolicy m_routeSharingPolicy;
 };
 
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (267928 => 267929)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-10-03 17:02:38 UTC (rev 267928)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-10-03 17:26:55 UTC (rev 267929)
@@ -582,8 +582,7 @@
     updatePreferences(parameters.store);
 
 #if PLATFORM(IOS_FAMILY) || ENABLE(ROUTING_ARBITRATION)
-    if (!m_page->settings().useGPUProcessForMediaEnabled())
-        DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(true);
+    DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(true);
 #endif
 
     m_backgroundColor = parameters.backgroundColor;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to