Deactivate audio session whenever possible
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 21:47:51 +0000 (21:47 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 7 Jan 2019 21:47:51 +0000 (21:47 +0000)
commit40ec20c4696685feb2b528165b83c20541b8f21e
tree240981f846f394d36e6c72e0f797c25b03c5edc7
parent2753a719786673f98e230c558d13d5027d462873
Deactivate audio session whenever possible
https://bugs.webkit.org/show_bug.cgi?id=193188
<rdar://problem/42678977>

Reviewed by Jer Noble.

Source/WebCore:

Test: media/deactivate-audio-session.html

* platform/audio/AudioSession.cpp:
(WebCore::AudioSession::tryToSetActive):
(WebCore::AudioSession::tryToSetActiveInternal):
* platform/audio/AudioSession.h:
(WebCore::AudioSession::isActive const):

* platform/audio/PlatformMediaSessionManager.cpp:
(WebCore::PlatformMediaSessionManager::removeSession):
(WebCore::deactivateAudioSession):
(WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession):
(WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession):
* platform/audio/PlatformMediaSessionManager.h:

* platform/audio/ios/AudioSessionIOS.mm:
(WebCore::AudioSession::tryToSetActiveInternal):
(WebCore::AudioSession::tryToSetActive): Deleted.

* platform/audio/mac/AudioSessionMac.cpp:
(WebCore::AudioSession::tryToSetActiveInternal):
(WebCore::AudioSession::tryToSetActive): Deleted.

* testing/Internals.cpp:
(WebCore::Internals::audioSessionActive const):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):

LayoutTests:

* TestExpectations: Skip the new test.
* media/deactivate-audio-session-expected.txt: Added.
* media/deactivate-audio-session.html: Added.
* platform/ios/TestExpectations: Run the new test.
* platform/mac-wk2/TestExpectations: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239694 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/media/deactivate-audio-session-expected.txt [new file with mode: 0644]
LayoutTests/media/deactivate-audio-session.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/audio/AudioSession.cpp
Source/WebCore/platform/audio/AudioSession.h
Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp
Source/WebCore/platform/audio/PlatformMediaSessionManager.h
Source/WebCore/platform/audio/ios/AudioSessionIOS.mm
Source/WebCore/platform/audio/mac/AudioSessionMac.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/WebPage.cpp