Optionally capture audio in the UIProcess
authorjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2017 04:10:53 +0000 (04:10 +0000)
committerjer.noble@apple.com <jer.noble@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2017 04:10:53 +0000 (04:10 +0000)
commit90e792ef7a9f398d86b7389d5fce3f29d8d407ab
tree24016e256a4662cd002d21e64b0f3e2f7712e594
parent9484eb59684ad40fc641a5b9021b1609a70b479f
Optionally capture audio in the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=169609

Reviewed by Alex Christensen.

Source/WebCore:

Export some previously un-exported symbols from WebCore for use in WebKit2.

* WebCore.xcodeproj/project.pbxproj:
* platform/audio/WebAudioBufferList.h:
* platform/mediastream/RealtimeMediaSource.h:

Source/WebKit2:

Add a new class pair, UserMediaCaptureManager/Proxy, to allow a RealtimeMediaSource
requested in a WebProcess to be created in the UIProcess and push its audio data across the
process boundary to its clients in the WebProcess. Because these classes are clients of the
RealtimeMediaSourceCenter::singleton(), they must be a singleton in the WebProcess as well,
so they are attached to the WebProcess class in the web process and to WebProcessProxy in
the UIProcess.

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Added.
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::SourceProxy):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::~SourceProxy):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::source):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::description):
(WebKit::UserMediaCaptureManagerProxy::SourceProxy::numberOfFrames):
(WebKit::UserMediaCaptureManagerProxy::UserMediaCaptureManagerProxy):
(WebKit::UserMediaCaptureManagerProxy::~UserMediaCaptureManagerProxy):
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
(WebKit::UserMediaCaptureManagerProxy::startProducingData):
(WebKit::UserMediaCaptureManagerProxy::stopProducingData):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
(WebKit::UserMediaCaptureManagerProxy::process):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in: Added.
* WebProcess/cocoa/UserMediaCaptureManager.cpp: Added.
(WebKit::nextSessionID):
(WebKit::UserMediaCaptureManager::Source::Source):
(WebKit::UserMediaCaptureManager::Source::~Source):
(WebKit::UserMediaCaptureManager::Source::setCapabilities):
(WebKit::UserMediaCaptureManager::Source::setSettings):
(WebKit::UserMediaCaptureManager::Source::description):
(WebKit::UserMediaCaptureManager::Source::setStorage):
(WebKit::UserMediaCaptureManager::Source::setRingBufferFrameBounds):
(WebKit::UserMediaCaptureManager::Source::audioSamplesAvailable):
(WebKit::UserMediaCaptureManager::UserMediaCaptureManager):
(WebKit::UserMediaCaptureManager::~UserMediaCaptureManager):
(WebKit::UserMediaCaptureManager::supplementName):
(WebKit::UserMediaCaptureManager::initialize):
(WebKit::UserMediaCaptureManager::createMediaSourceForCaptureDeviceWithConstraints):
(WebKit::UserMediaCaptureManager::sourceStopped):
(WebKit::UserMediaCaptureManager::sourceMutedChanged):
(WebKit::UserMediaCaptureManager::sourceEnabledChanged):
(WebKit::UserMediaCaptureManager::sourceSettingsChanged):
(WebKit::UserMediaCaptureManager::storageChanged):
(WebKit::UserMediaCaptureManager::ringBufferFrameBoundsChanged):
(WebKit::UserMediaCaptureManager::audioSamplesAvailable):
(WebKit::UserMediaCaptureManager::startProducingData):
(WebKit::UserMediaCaptureManager::stopProducingData):
* WebProcess/cocoa/UserMediaCaptureManager.h: Added.
* WebProcess/cocoa/UserMediaCaptureManager.messages.in: Added.

Initialize UserMediaCaptureManager/Proxy:

* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
* UIProcess/WebProcessProxy.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):

WebUserMediaClientMac is no longer necessary now that the UserMediaCaptureManager overrides
the factories:

* WebProcess/WebCoreSupport/WebUserMediaClient.cpp:
(WebKit::WebUserMediaClient::WebUserMediaClient):
(WebKit::WebUserMediaClient::initializeFactories): Deleted.

Add a new preference and WebProcessCreationParameters member to control whether
capturing is done in the UIProcess:

* Shared/WebPreferencesDefinitions.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:

Add new files to the project:

* DerivedSources.make:
* WebKit2.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/audio/WebAudioBufferList.h
Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h
Source/WebCore/platform/audio/mac/CARingBuffer.h
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebKit2/ChangeLog
Source/WebKit2/DerivedSources.make
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h [moved from Source/WebKit2/WebProcess/WebCoreSupport/cocoa/WebUserMediaClientMac.mm with 56% similarity]
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in [new file with mode: 0644]
Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebUserMediaClient.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.h [new file with mode: 0644]
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.messages.in [new file with mode: 0644]