Add support for reading and writing settings from UIProcess audio capture
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 23:31:56 +0000 (23:31 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 23:31:56 +0000 (23:31 +0000)
commit22938dd4eb81d37c29ee6203002887eeb9471a82
tree64862df51cf6a688dfd543e445795f19d95ab7a1
parent03662ecc8e3f3cd428708f1a798acd4a92fa4764
Add support for reading and writing settings from UIProcess audio capture
https://bugs.webkit.org/show_bug.cgi?id=171633

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-08
Reviewed by Eric Carlson.

Source/WebCore:

Covered by manual testing and existing test sets.

Moving success/failure callbacks for applyConstraints.
Making main RealtimeMediaSource::applyConstraints virtual so that WebProcess source proxies can implement it by
doing an IPC call directly. Doing so for UIProcess CoreAudioCaptureSource.

Adding support for volume to CoreAudioCaptureSource by applying gain post-capturing.
Adding support for toggling echo cancellation in CoreAudioCaptureSource.
Adding support to change echo cancellation and sample rate by scheduling a reconfiguration of the audio unit.
To do so, we stop producing data, delete the audio unit and restart producing data.
Removing CoreAudioCaptureSource::supportedConstraints as it is redundant with
RealtimeMediaSourceSettings::supportedConstraints.

Setting sample rate only to the following values: 8000, 16000, 32000, 44100, 48000.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::applyConstraints):
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::applyConstraints):
* platform/mediastream/MediaStreamTrackPrivate.h:
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::applyConstraints):
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeMediaSourceSettings.h:
(WebCore::RealtimeMediaSourceSettings::supportedConstraints):
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::processMicrophoneSamples):
(WebCore::CoreAudioCaptureSource::cleanupAudioUnit):
(WebCore::CoreAudioCaptureSource::createAudioUnit):
(WebCore::CoreAudioCaptureSource::configureAudioUnit):
(WebCore::CoreAudioCaptureSource::startProducingData):
(WebCore::CoreAudioCaptureSource::capabilities):
(WebCore::CoreAudioCaptureSource::settings):
(WebCore::CoreAudioCaptureSource::applySampleRate):
(WebCore::CoreAudioCaptureSource::applyEchoCancellation):
(WebCore::CoreAudioCaptureSource::scheduleReconfiguration):
(WebCore::CoreAudioCaptureSource::cleanupAudioUnits): Deleted.
(WebCore::CoreAudioCaptureSource::setupAudioUnits): Deleted.
* platform/mediastream/mac/CoreAudioCaptureSource.h:

Source/WebKit2:

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
(WebKit::UserMediaCaptureManagerProxy::applyConstraints):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::setSettings):
(WebKit::UserMediaCaptureManager::Source::applyConstraintsSucceeded):
(WebKit::UserMediaCaptureManager::Source::applyConstraintsFailed):
(WebKit::UserMediaCaptureManager::createCaptureSource):
(WebKit::UserMediaCaptureManager::sourceSettingsChanged):
(WebKit::UserMediaCaptureManager::applyConstraints):
(WebKit::UserMediaCaptureManager::applyConstraintsSucceeded):
(WebKit::UserMediaCaptureManager::applyConstraintsFailed):
(WebKit::UserMediaCaptureManager::Source::setMuted): Deleted.
(WebKit::UserMediaCaptureManager::Source::setEnabled): Deleted.
* WebProcess/cocoa/UserMediaCaptureManager.h:
* WebProcess/cocoa/UserMediaCaptureManager.messages.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp
Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.h
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
Source/WebKit2/UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.cpp
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.h
Source/WebKit2/WebProcess/cocoa/UserMediaCaptureManager.messages.in