Changeset 269134 in webkit
- Timestamp:
- Oct 28, 2020, 7:40:31 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
platform/audio/cocoa/AudioOutputUnitAdaptor.cpp (modified) (1 diff)
-
platform/audio/ios/MediaSessionManagerIOS.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269124 r269134 1 2020-10-28 Chris Dumez <cdumez@apple.com> 2 3 Web Audio broken on iOS 14 after switching app 4 https://bugs.webkit.org/show_bug.cgi?id=217606 5 <rdar://problem/70231769> 6 7 Reviewed by Eric Carlson. 8 9 When we call AudioOutputUnitStart(), AVFoundation checks if we are allowed to play by 10 making sure that our application is foreground. In order to do that, AVFoundation 11 needs the PID of our hosting application. We provide this PID whenever the following 12 function is called: 13 MediaSessionManageriOS::providePresentingApplicationPIDIfNecessary() 14 15 The issue was that we were not calling providePresentingApplicationPIDIfNecessary() 16 before starting WebAudio playback. As a result, AVFoundation was relying on the 17 visibility of the WebContent process itself. This was causing a race because 18 RunningBoard gets notified that the WebContent process is visible a little later 19 than for the UIProcess. When the UIProcess would become foreground, we would send 20 the SetApplicationState IPC to the WebProcess, which would update the page's 21 visibility and cause us to stop the media session interruption. This would cause 22 us to call AudioOutputUnitStart(), which would fail because AVFoundation would 23 ask RunningBoard if the WebContent process is foreground. At this point, 24 RunningBoard would not necessarily know yet that the WebContent process is 25 visible. However, RunningBoard reliably knows the UIProcess is visible at this 26 point. 27 28 We now call this function inside MediaSessionManageriOS::sessionWillBeginPlayback() 29 since this gets called by WebAudio code before starting the playback. 30 31 * platform/audio/cocoa/AudioOutputUnitAdaptor.cpp: 32 (WebCore::AudioOutputUnitAdaptor::start): 33 Add some error logging when the call to AudioOutputUnitStart() fails to facilitate 34 debugging such issues in the future. 35 36 * platform/audio/ios/MediaSessionManagerIOS.mm: 37 (WebCore::MediaSessionManageriOS::sessionWillBeginPlayback): 38 1 39 2020-10-28 Conrad Shultz <conrad_shultz@apple.com> 2 40 -
trunk/Source/WebCore/platform/audio/cocoa/AudioOutputUnitAdaptor.cpp
r268632 r269134 45 45 OSStatus AudioOutputUnitAdaptor::start() 46 46 { 47 return AudioOutputUnitStart(m_outputUnit); 47 auto result = AudioOutputUnitStart(m_outputUnit); 48 if (result != noErr) 49 WTFLogAlways("ERROR: AudioOutputUnitStart() call failed with error code: %ld", static_cast<long>(result)); 50 return result; 48 51 } 49 52 -
trunk/Source/WebCore/platform/audio/ios/MediaSessionManagerIOS.mm
r267198 r269134 153 153 #endif 154 154 155 providePresentingApplicationPIDIfNecessary(); 156 155 157 return true; 156 158 }
Note:
See TracChangeset
for help on using the changeset viewer.