[iOS] Respond to AudioSession interruption and resume
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jun 2017 15:40:05 +0000 (15:40 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Jun 2017 15:40:05 +0000 (15:40 +0000)
commit5a3cae3c5b9430057575aaaf79dd3d96eb7273f4
tree1273f75e13bbced7e814d8786c5633179e43900e
parente22df88171e37f7b38061fa7f7d0b7eefe209723
[iOS] Respond to AudioSession interruption and resume
https://bugs.webkit.org/show_bug.cgi?id=173718
<rdar://problem/32925263>

Reviewed by Youenn Fablet.

Tested manually.

* WebCore.xcodeproj/project.pbxproj: Add CoreAudioCaptureSourceIOS.mm/.h

* platform/mediastream/RealtimeMediaSource.h: Make createWeakPtr protected so derived classes
can use it.

* platform/mediastream/ios/CoreAudioCaptureSourceIOS.h: Added.
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Added.
(-[WebCoreAudioCaptureSourceIOSListener initWithCallback:]):
(-[WebCoreAudioCaptureSourceIOSListener invalidate]):
(-[WebCoreAudioCaptureSourceIOSListener handleInterruption:]):
(-[WebCoreAudioCaptureSourceIOSListener sessionMediaServicesWereReset:]):
(WebCore::CoreAudioCaptureSourceIOS::CoreAudioCaptureSourceIOS):
(WebCore::CoreAudioCaptureSourceIOS::~CoreAudioCaptureSourceIOS):

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::suspended):
(WebCore::CoreAudioSharedUnit::setupAudioUnit): Clear m_suspended.
(WebCore::CoreAudioSharedUnit::suspend): Don't clear sources or uninitialize the audio unit,
suspend is temporary. Set m_suspended.
(WebCore::CoreAudioSharedUnit::resume): New, restart the audio unit.
(WebCore::CoreAudioCaptureSource::create): Create the correct object.
(WebCore::CoreAudioCaptureSource::scheduleReconfiguration): Dispatch to main thread if necessary.
(WebCore::CoreAudioCaptureSource::beginInterruption): New, suspend from main thread.
(WebCore::CoreAudioCaptureSource::endInterruption): New, resume/reconfigure from main thread.
(WebCore::CoreAudioCaptureSource::interrupted):
* platform/mediastream/mac/CoreAudioCaptureSource.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm [new file with mode: 0644]
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h