Changeset 276570 in webkit
- Timestamp:
- Apr 25, 2021, 1:32:24 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
GPUProcess/media/RemoteAudioSessionProxy.cpp (modified) (1 diff)
-
GPUProcess/media/RemoteAudioSessionProxy.h (modified) (1 diff)
-
GPUProcess/media/RemoteAudioSessionProxyManager.cpp (modified) (2 diffs)
-
GPUProcess/media/RemoteAudioSessionProxyManager.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r276566 r276570 1 2021-04-25 Jer Noble <jer.noble@apple.com> 2 3 [GPUP][iOS] Silent video playback can interrupt system audio 4 https://bugs.webkit.org/show_bug.cgi?id=225031 5 <rdar://76652073> 6 7 Reviewed by Eric Carlson. 8 9 When the WebContent process asks the GPU Process to set the AVAudioSession audio session 10 category, the GPU Process as an optimization returns early if the session category being 11 requested is the same as has already been set. However, the default value of the category 12 is "None" (which translates to AVAudioSessionCategoryAmbient), and setting the category 13 to "None" becomes a no-op due to this default. As such, the GPUP never sets the underlying 14 AVAudioSession's category away from the default, which is AVAudioSessionCategorySoloAmbient, 15 and thus will interrupt other audio during playback. 16 17 Additionally, there's a subtle logic error where the audio session category is not changed 18 when a given WebContent process (and it's RemoteAudioSession & Proxy) goes away. 19 20 The fix for both of these issues is to re-calculate the correct audio session category 21 when a RemoteAudioSessionProxy is added or removed from RemoteAudioSessionProxyManager. 22 Since "None" is the default value for a RemoteAudioSessionProxy, the mere act of adding 23 a new RemoteAudioSessionProxy (which is created when a WebContent process is created) 24 will cause the audio session category to be set to AVAudioSessionCategoryAmbient. 25 26 * GPUProcess/media/RemoteAudioSessionProxy.cpp: 27 (WebKit::RemoteAudioSessionProxy::setCategory): 28 * GPUProcess/media/RemoteAudioSessionProxy.h: 29 * GPUProcess/media/RemoteAudioSessionProxyManager.cpp: 30 (WebKit::RemoteAudioSessionProxyManager::addProxy): 31 (WebKit::RemoteAudioSessionProxyManager::removeProxy): 32 (WebKit::RemoteAudioSessionProxyManager::updateCategory): 33 (WebKit::RemoteAudioSessionProxyManager::setCategoryForProcess): Deleted. 34 * GPUProcess/media/RemoteAudioSessionProxyManager.h: 35 1 36 2021-04-25 Dean Jackson <dino@apple.com> 2 37 -
trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp
r274891 r276570 81 81 m_category = category; 82 82 m_routeSharingPolicy = policy; 83 audioSessionManager(). setCategoryForProcess(*this, category, policy);83 audioSessionManager().updateCategory(); 84 84 } 85 85 -
trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h
r274189 r276570 79 79 80 80 GPUConnectionToWebProcess& m_gpuConnection; 81 WebCore::AudioSession::CategoryType m_category ;82 WebCore::RouteSharingPolicy m_routeSharingPolicy ;81 WebCore::AudioSession::CategoryType m_category { WebCore::AudioSession::None }; 82 WebCore::RouteSharingPolicy m_routeSharingPolicy { WebCore::RouteSharingPolicy::Default }; 83 83 size_t m_preferredBufferSize { 0 }; 84 84 bool m_active { false }; -
trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp
r270705 r276570 59 59 ASSERT(!m_proxies.contains(proxy)); 60 60 m_proxies.add(proxy); 61 updateCategory(); 61 62 } 62 63 … … 65 66 ASSERT(m_proxies.contains(proxy)); 66 67 m_proxies.remove(proxy); 68 updateCategory(); 67 69 } 68 70 69 void RemoteAudioSessionProxyManager:: setCategoryForProcess(RemoteAudioSessionProxy& proxy, AudioSession::CategoryType category, RouteSharingPolicy policy)71 void RemoteAudioSessionProxyManager::updateCategory() 70 72 { 73 AudioSession::CategoryType category = AudioSession::None; 74 RouteSharingPolicy policy = RouteSharingPolicy::Default; 75 71 76 HashCountedSet<AudioSession::CategoryType, WTF::IntHash<AudioSession::CategoryType>, WTF::StrongEnumHashTraits<AudioSession::CategoryType>> categoryCounts; 72 77 HashCountedSet<RouteSharingPolicy, WTF::IntHash<RouteSharingPolicy>, WTF::StrongEnumHashTraits<RouteSharingPolicy>> policyCounts; -
trunk/Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h
r258390 r276570 47 47 void removeProxy(RemoteAudioSessionProxy&); 48 48 49 void setCategoryForProcess(RemoteAudioSessionProxy&, WebCore::AudioSession::CategoryType, WebCore::RouteSharingPolicy);49 void updateCategory(); 50 50 void setPreferredBufferSizeForProcess(RemoteAudioSessionProxy&, size_t); 51 51
Note:
See TracChangeset
for help on using the changeset viewer.