[MediaStream] Set correct audio session category when capturing audio
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Apr 2017 18:27:01 +0000 (18:27 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Apr 2017 18:27:01 +0000 (18:27 +0000)
commit3585cf4dc70ebb54f60adecae563ffe0912e3652
tree9178d7bee4259500691e8408f2f824ac0fd100cc
parent54c8b1906d16b833b4b26f76b1c918307cb80155
[MediaStream] Set correct audio session category when capturing audio
https://bugs.webkit.org/show_bug.cgi?id=170736
<rdar://problem/31559405>

Reviewed by Jer Noble.

Source/WebCore:

No new tests yet, filed bug 170737.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::MediaStream): Initialize m_mediaSession.
(WebCore::MediaStream::statusDidChange): Call canProduceAudioChanged.
(WebCore::MediaStream::mediaType): New. Return MediaStreamCapturingAudio when actively
capturing audio.
(WebCore::MediaStream::presentationType):
(WebCore::MediaStream::characteristics):
(WebCore::MediaStream::mayResumePlayback):
(WebCore::MediaStream::suspendPlayback):
(WebCore::MediaStream::sourceApplicationIdentifier):
(WebCore::MediaStream::canProduceAudio):
* Modules/mediastream/MediaStream.h:

* platform/audio/PlatformMediaSession.h: Add MediaStreamCapturingAudio.
* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::has): Adjust assert for MediaStreamCapturingAudio.
(WebCore::PlatformMediaSessionManager::count): Ditto.
* platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
(PlatformMediaSessionManager::updateSessionState): Set small preferred buffer size when
capturing audio. Set audio session category to PlayAndRecord whenever there is a media
stream that is capturing audio.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::isPlayingMediaDidChange):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215242 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/platform/audio/PlatformMediaSession.h
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.cpp
Source/WebCore/testing/Internals.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebPageProxy.cpp