[MediaStream iOS] Cleanup video muting/unmuting when tab visibility changes
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 21:16:53 +0000 (21:16 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Jun 2017 21:16:53 +0000 (21:16 +0000)
commit72771bd1c60ed20805a5332c7ed933f180fdf69b
tree406591ddea9d5ab9e05691e69046fd9e8d17695f
parent3c9a3c448207a0b82e3b66795990370f870748ed
[MediaStream iOS] Cleanup video muting/unmuting when tab visibility changes
https://bugs.webkit.org/show_bug.cgi?id=172858

Reviewed by Youenn Fablet.

Source/WebCore:

Test: platform/ios/mediastream/video-muted-in-background-tab.html

* dom/Document.cpp:
(WebCore::Document::visibilityStateChanged): Call notifyMediaCaptureOfVisibilityChanged.
(WebCore::Document::notifyMediaCaptureOfVisibilityChanged): Renamed from notifyVisibilityChangedToMediaCapture.
Set m_videoCaptureMutedForVisibilityChange when capture is muted because the document is hidden,
and clear it when visibility changes when capture is disabled. Don't unmute when the document
becomes visible unless this m_videoCaptureMutedForVisibilityChange is still true.
(WebCore::Document::notifyVisibilityChangedToMediaCapture): Deleted.
* dom/Document.h:

* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::setVideoCaptureMutedForPageVisibility): Renamed from
setVisibility.
(WebCore::RealtimeMediaSourceCenter::setVisibility): Deleted.
* platform/mediastream/RealtimeMediaSourceCenter.h:

* platform/mediastream/mac/AVVideoCaptureSource.mm:
(WebCore::AVVideoCaptureSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
(WebCore::AVVideoCaptureSourceFactory::setVisibility): Deleted.

* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSourceFactory::setVideoCaptureMutedForPageVisibility): Ditto.
(WebCore::MockRealtimeVideoSourceFactory::setVisibility): Deleted.

LayoutTests:

* platform/ios/mediastream/video-muted-in-background-tab-expected.txt: Added.
* platform/ios/mediastream/video-muted-in-background-tab.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@217734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/platform/ios/mediastream/video-muted-in-background-tab-expected.txt [new file with mode: 0644]
LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h
Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm
Source/WebCore/platform/mock/MockRealtimeVideoSource.cpp