Video capture does not get unmuted in case of tab switch on iOS
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2020 10:54:07 +0000 (10:54 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2020 10:54:07 +0000 (10:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211509

Reviewed by Eric Carlson.

Source/WebCore:

Remove setInterrupted and related code.
Instead, directly use setMuted(true/false) of the source of capture tracks.
To ensure we validate that the active source is tied to a track of the document,
we add RealtimeSource::isSameAs which handles the case of a RealtimeVideoSource wrapping an AVVideoCaptureSource.
There might be multiple video tracks with each one its RealtimeVideoSource using the same AVVideoCaptureSource.
We mute the AVVideoCaptureSource directly to make sure all linked tracks will get muted/unmuted at the same time.
Tests to be fixed.

* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::isSourceCapturingForDocument):
(WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState):
* Modules/mediastream/MediaStreamTrack.h:
* dom/Document.cpp:
(WebCore::Document::visibilityStateChanged):
* platform/mediastream/RealtimeMediaSource.cpp:
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/RealtimeMediaSourceFactory.h:
* platform/mediastream/RealtimeVideoSource.h:
* platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
* platform/mediastream/mac/CoreAudioCaptureSource.h:
* platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
* platform/mock/MockRealtimeMediaSourceCenter.cpp:

Source/WebKit:

Remove no longer needed code.

* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource):
* WebProcess/cocoa/UserMediaCaptureManager.h:

LayoutTests:

* platform/ios/TestExpectations:
Disable GPU process test since we are not able yet to mute/unmute handle multiple video tracks
with different sources as can be done if capture is done out of process.
* platform/ios/mediastream/video-muted-in-background-tab.html:
Update test to ensure the track is producing content.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261373 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/dom/Document.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h
Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h
Source/WebCore/platform/mediastream/RealtimeVideoSource.h
Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h
Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp
Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h

index ddb3609..1a98969 100644 (file)
@@ -1,3 +1,16 @@
+2020-05-08  Youenn Fablet  <youenn@apple.com>
+
+        Video capture does not get unmuted in case of tab switch on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=211509
+
+        Reviewed by Eric Carlson.
+
+        * platform/ios/TestExpectations:
+        Disable GPU process test since we are not able yet to mute/unmute handle multiple video tracks
+        with different sources as can be done if capture is done out of process.
+        * platform/ios/mediastream/video-muted-in-background-tab.html:
+        Update test to ensure the track is producing content.
+
 2020-05-08  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK][WPE] Gardening, update expectations and baselines after r261341
index 233a938..125764e 100644 (file)
@@ -2880,6 +2880,8 @@ http/tests/multipart/load-last-non-html-frame.php [ Failure  ]
 
 webkit.org/b/177366 http/tests/security/frameNavigation/sandbox-ALLOWED-top-navigation-with-user-gesture-1.html [ Pass Timeout ]
 
+webkit.org/b/211509 platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html [ Failure ]
+
 webkit.org/b/177395 fast/mediastream/RTCPeerConnection-overloaded-operations.html [ Pass Failure ]
 fast/mediastream/MediaStream-video-element-video-tracks-disabled.html [ ImageOnlyFailure ]
 fast/mediastream/getUserMedia-webaudio.html [ Pass Failure ]
index 4c56661..be95f33 100644 (file)
             let audioTrack;
             let videoTrack;
 
+            async function validateMediaStreamTrackIsGeneratingContent(track)
+            {
+                if (!window.internals)
+                    return true;
+                internals.observeMediaStreamTrack(track);
+                let count = 100;
+                do {
+                    await new Promise(resolve => setTimeout(resolve, 50));
+                    if (internals.trackAudioSampleCount || internals.trackVideoSampleCount)
+                        return true;
+                } while (--count > 0);
+                return false;
+            }
+
             promise_test((t) => {
                 if (window.testRunner)
                     testRunner.setUserMediaPermission(true);
                     assert_false(audioTrack.muted, "audio track is active");
                     assert_false(videoTrack.muted, "video track is active");
                 })
+            }, "Setup stream");
 
-                .then(() => {
-                    test(() => {
-                        if (window.internals)
-                            window.internals.setPageVisibility(false);
-                        assert_false(audioTrack.muted, "audio track is active");
-                        assert_true(videoTrack.muted, "video track is muted");
-                    }, "Hide page, only video should be muted");
-                })
+            promise_test(async (t) => {
+                if (window.internals)
+                    window.internals.setPageVisibility(false);
+                assert_false(audioTrack.muted, "audio track is active");
+                assert_true(videoTrack.muted, "video track is muted");
+            }, "Hide page, only video should be muted");
 
-                .then(() => {
-                    test(() => {
-                        if (window.internals)
-                            window.internals.setPageVisibility(true);
-                        assert_false(audioTrack.muted, "audio track is active");
-                        assert_false(videoTrack.muted, "video track is active");
-                    }, "Show page, video and audio should be unmuted");
-                })
+            promise_test(async (t) => {
+                if (window.internals)
+                    window.internals.setPageVisibility(true);
+                assert_false(audioTrack.muted, "audio track is active");
+                assert_false(videoTrack.muted, "video track is active");
 
-                .then(() => {
-                    test(() => {
-                        if (window.internals) {
-                            window.internals.setPageVisibility(false);
-                            window.internals.setPageMuted("capturedevices");
-                        }
-                        assert_true(audioTrack.muted, "audio track is muted");
-                        assert_true(videoTrack.muted, "video track is muted");
-                    }, "Hide and mute page, video and audio should be muted");
-                })
+                assert_true(await validateMediaStreamTrackIsGeneratingContent(audioTrack), "audio track");
+                assert_true(await validateMediaStreamTrackIsGeneratingContent(videoTrack), "video track");
+            }, "Show page, video and audio should be unmuted");
 
-                .then(() => {
-                    test(() => {
-                        if (window.internals)
-                            window.internals.setPageVisibility(true);
-                        assert_true(audioTrack.muted, "audio track is muted");
-                        assert_true(videoTrack.muted, "video track is muted");
-                    }, "Show page, video and audio should remain muted");
-                })
-            }, "Setup stream");
+            promise_test(async (t) => {
+                if (window.internals) {
+                    window.internals.setPageVisibility(false);
+                    window.internals.setPageMuted("capturedevices");
+                }
+                assert_true(audioTrack.muted, "audio track is muted");
+                assert_true(videoTrack.muted, "video track is muted");
+            }, "Hide and mute page, video and audio should be muted");
 
+            promise_test(async (t) => {
+                if (window.internals)
+                    window.internals.setPageVisibility(true);
+                assert_true(audioTrack.muted, "audio track is muted");
+                assert_true(videoTrack.muted, "video track is muted");
+            }, "Show page, video and audio should remain muted");
         </script>
     </body>
-</html>
\ No newline at end of file
+</html>
index ba00a9e..024a6ab 100644 (file)
@@ -1,3 +1,36 @@
+2020-05-08  Youenn Fablet  <youenn@apple.com>
+
+        Video capture does not get unmuted in case of tab switch on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=211509
+
+        Reviewed by Eric Carlson.
+
+        Remove setInterrupted and related code.
+        Instead, directly use setMuted(true/false) of the source of capture tracks.
+        To ensure we validate that the active source is tied to a track of the document,
+        we add RealtimeSource::isSameAs which handles the case of a RealtimeVideoSource wrapping an AVVideoCaptureSource.
+        There might be multiple video tracks with each one its RealtimeVideoSource using the same AVVideoCaptureSource.
+        We mute the AVVideoCaptureSource directly to make sure all linked tracks will get muted/unmuted at the same time.
+        Tests to be fixed.
+
+        * Modules/mediastream/MediaStreamTrack.cpp:
+        (WebCore::MediaStreamTrack::MediaStreamTrack):
+        (WebCore::isSourceCapturingForDocument):
+        (WebCore::MediaStreamTrack::updateCaptureAccordingToMutedState):
+        * Modules/mediastream/MediaStreamTrack.h:
+        * dom/Document.cpp:
+        (WebCore::Document::visibilityStateChanged):
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        * platform/mediastream/RealtimeMediaSource.h:
+        * platform/mediastream/RealtimeMediaSourceCenter.cpp:
+        * platform/mediastream/RealtimeMediaSourceCenter.h:
+        * platform/mediastream/RealtimeMediaSourceFactory.h:
+        * platform/mediastream/RealtimeVideoSource.h:
+        * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
+        * platform/mediastream/mac/CoreAudioCaptureSource.h:
+        * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
+        * platform/mock/MockRealtimeMediaSourceCenter.cpp:
+
 2020-05-07  Simon Fraser  <simon.fraser@apple.com>
 
         MayBegin wheel event in a <select> doesn't flash the scrollers
index 085e4fd..d97392c 100644 (file)
@@ -47,6 +47,7 @@
 #include "Page.h"
 #include "PlatformMediaSessionManager.h"
 #include "RealtimeMediaSourceCenter.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScriptExecutionContext.h"
 #include <wtf/CompletionHandler.h>
 #include <wtf/IsoMallocInlines.h>
@@ -68,6 +69,10 @@ Ref<MediaStreamTrack> MediaStreamTrack::create(ScriptExecutionContext& context,
 {
     auto track = adoptRef(*new MediaStreamTrack(context, WTFMove(privateTrack)));
     track->suspendIfNeeded();
+
+    if (track->isCaptureTrack())
+        track->updateToPageMutedState();
+
     return track;
 }
 
@@ -87,11 +92,6 @@ MediaStreamTrack::MediaStreamTrack(ScriptExecutionContext& context, Ref<MediaStr
 
     if (m_private->type() == RealtimeMediaSource::Type::Audio)
         PlatformMediaSessionManager::sharedManager().addAudioCaptureSource(*this);
-
-    if (auto document = this->document()) {
-        if (document->page() && document->page()->mutedState())
-            setMuted(true);
-    }
 }
 
 MediaStreamTrack::~MediaStreamTrack()
@@ -195,26 +195,6 @@ bool MediaStreamTrack::muted() const
     return m_private->muted();
 }
 
-void MediaStreamTrack::setMuted(MediaProducer::MutedStateFlags state)
-{
-    bool trackMuted = false;
-    switch (source().deviceType()) {
-    case CaptureDevice::DeviceType::Microphone:
-    case CaptureDevice::DeviceType::Camera:
-        trackMuted = state & MediaProducer::AudioAndVideoCaptureIsMuted;
-        break;
-    case CaptureDevice::DeviceType::Screen:
-    case CaptureDevice::DeviceType::Window:
-        trackMuted = state & MediaProducer::ScreenCaptureIsMuted;
-        break;
-    case CaptureDevice::DeviceType::Unknown:
-        ASSERT_NOT_REACHED();
-        break;
-    }
-
-    m_private->setMuted(trackMuted);
-}
-
 auto MediaStreamTrack::readyState() const -> State
 {
     return ended() ? State::Ended : State::Live;
@@ -468,44 +448,67 @@ MediaProducer::MediaStateFlags MediaStreamTrack::captureState(Document& document
 }
 
 #if PLATFORM(IOS_FAMILY)
-static MediaStreamTrack* findActiveCaptureTrackForDocument(Document& document, RealtimeMediaSource* activeSource, RealtimeMediaSource::Type type)
+static bool isSourceCapturingForTrackInDocument(RealtimeMediaSource& source, Document& document)
 {
-    MediaStreamTrack* selectedTrack = nullptr;
-    for (auto* captureTrack : allCaptureTracks()) {
-        if (captureTrack->document() != &document || captureTrack->ended())
+    for (auto* track : allCaptureTracks()) {
+        if (track->document() != &document || track->ended())
             continue;
 
-        if (&captureTrack->source() == activeSource)
-            return captureTrack;
-
-        // If the document has a live capture track, which is not the active one, we pick the first one.
-        // FIXME: We should probably store per page active audio/video capture tracks.
-        if (!selectedTrack && captureTrack->privateTrack().type() == type)
-            selectedTrack = captureTrack;
+        if (track->source().isSameAs(source))
+            return true;
     }
-    return selectedTrack;
+    return false;
 }
 #endif
 
 void MediaStreamTrack::updateCaptureAccordingToMutedState(Document& document)
 {
 #if PLATFORM(IOS_FAMILY)
+    auto* page = document.page();
+    if (!page)
+        return;
+
     auto* activeAudioSource = RealtimeMediaSourceCenter::singleton().audioCaptureFactory().activeSource();
-    if (auto* audioCaptureTrack = findActiveCaptureTrackForDocument(document, activeAudioSource, RealtimeMediaSource::Type::Audio))
-        audioCaptureTrack->setMuted(document.page()->mutedState());
+    if (activeAudioSource && isSourceCapturingForTrackInDocument(*activeAudioSource, document)) {
+        bool pageMuted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;
+        activeAudioSource->setMuted(pageMuted || (document.hidden() && RuntimeEnabledFeatures::sharedFeatures().interruptAudioOnPageVisibilityChangeEnabled()));
+    }
 
     auto* activeVideoSource = RealtimeMediaSourceCenter::singleton().videoCaptureFactory().activeSource();
-    if (auto* videoCaptureTrack = findActiveCaptureTrackForDocument(document, activeVideoSource, RealtimeMediaSource::Type::Video))
-        videoCaptureTrack->setMuted(document.page()->mutedState());
+    if (activeVideoSource && isSourceCapturingForTrackInDocument(*activeVideoSource, document)) {
+        bool pageMuted = page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted;
+        activeVideoSource->setMuted(pageMuted || document.hidden());
+    }
 #else
     for (auto* captureTrack : allCaptureTracks()) {
-        if (captureTrack->document() != &document || captureTrack->ended())
-            continue;
-        captureTrack->setMuted(document.page()->mutedState());
+        if (captureTrack->document() == &document && !captureTrack->ended())
+            captureTrack->updateToPageMutedState();
     }
 #endif
 }
 
+void MediaStreamTrack::updateToPageMutedState()
+{
+    ASSERT(isCaptureTrack());
+    auto* page = document()->page();
+    if (!page)
+        return;
+
+    switch (source().deviceType()) {
+    case CaptureDevice::DeviceType::Microphone:
+    case CaptureDevice::DeviceType::Camera:
+        m_private->setMuted(page->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted);
+        break;
+    case CaptureDevice::DeviceType::Screen:
+    case CaptureDevice::DeviceType::Window:
+        m_private->setMuted(page->mutedState() & MediaProducer::ScreenCaptureIsMuted);
+        break;
+    case CaptureDevice::DeviceType::Unknown:
+        ASSERT_NOT_REACHED();
+        break;
+    }
+}
+
 void MediaStreamTrack::endCapture(Document& document)
 {
     bool didEndCapture = false;
index 02fd454..b00f049 100644 (file)
@@ -87,7 +87,6 @@ public:
     void setEnabled(bool);
 
     bool muted() const;
-    void setMuted(MediaProducer::MutedStateFlags);
 
     enum class State { Live, Ended };
     State readyState() const;
@@ -169,6 +168,7 @@ private:
     explicit MediaStreamTrack(MediaStreamTrack&);
 
     void configureTrackRendering();
+    void updateToPageMutedState();
 
     // ActiveDOMObject API.
     void stop() final { stopTrack(); }
index f13f837..960dd60 100644 (file)
@@ -1749,17 +1749,10 @@ void Document::visibilityStateChanged()
     for (auto* client : m_visibilityStateCallbackClients)
         client->visibilityStateChanged();
 
-#if ENABLE(MEDIA_STREAM)
-    auto* page = this->page();
-    if (page && hidden()) {
-        RealtimeMediaSourceCenter::singleton().setCapturePageState(true, page->isMediaCaptureMuted());
-        return;
-    }
-#if PLATFORM(IOS_FAMILY)
+#if ENABLE(MEDIA_STREAM) && PLATFORM(IOS_FAMILY)
     if (!PlatformMediaSessionManager::sharedManager().isInterrupted())
         MediaStreamTrack::updateCaptureAccordingToMutedState(*this);
 #endif
-#endif
 }
 
 VisibilityState Document::visibilityState() const
index 5b44245..6e9f5b9 100644 (file)
@@ -88,16 +88,6 @@ void RealtimeMediaSource::removeObserver(Observer& observer)
         stopBeingObserved();
 }
 
-void RealtimeMediaSource::setInterrupted(bool interrupted, bool pageMuted)
-{
-#if RELEASE_LOG_DISABLED
-    UNUSED_PARAM(pageMuted);
-#endif
-
-    ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, interrupted, ", page muted : ", pageMuted);
-    setMuted(interrupted);
-}
-
 void RealtimeMediaSource::setMuted(bool muted)
 {
     ALWAYS_LOG_IF(m_logger, LOGIDENTIFIER, muted);
index 66aa350..f8abaa3 100644 (file)
@@ -127,7 +127,6 @@ public:
     bool captureDidFail() const { return m_captureDidFailed; }
 
     virtual bool interrupted() const { return m_interrupted; }
-    virtual void setInterrupted(bool, bool);
 
     const String& name() const { return m_name; }
     void setName(String&& name) { m_name = WTFMove(name); }
@@ -193,6 +192,7 @@ public:
 
     virtual void captureFailed();
 
+    virtual bool isSameAs(RealtimeMediaSource& source) const { return this == &source; }
     virtual bool isIncomingAudioSource() const { return false; }
     virtual bool isIncomingVideoSource() const { return false; }
 
index dc48a75..2d32b24 100644 (file)
@@ -38,7 +38,6 @@
 #include "CaptureDeviceManager.h"
 #include "Logging.h"
 #include "MediaStreamPrivate.h"
-#include "RuntimeEnabledFeatures.h"
 #include <wtf/SHA1.h>
 
 namespace WebCore {
@@ -271,13 +270,6 @@ void RealtimeMediaSourceCenter::validateRequestConstraints(ValidConstraintsHandl
     validHandler(WTFMove(audioDevices), WTFMove(videoDevices), WTFMove(deviceIdentifierHashSalt));
 }
 
-void RealtimeMediaSourceCenter::setCapturePageState(bool interrupted, bool pageMuted)
-{
-    if (RuntimeEnabledFeatures::sharedFeatures().interruptAudioOnPageVisibilityChangeEnabled())
-        audioCaptureFactory().setAudioCapturePageState(interrupted, pageMuted);
-    videoCaptureFactory().setVideoCapturePageState(interrupted, pageMuted);
-}
-
 void RealtimeMediaSourceCenter::setAudioCaptureFactory(AudioCaptureFactory& factory)
 {
     m_audioCaptureFactoryOverride = &factory;
index 10ddb29..0282865 100644 (file)
@@ -86,8 +86,6 @@ public:
 
     WEBCORE_EXPORT void setDevicesChangedObserver(std::function<void()>&&);
 
-    void setCapturePageState(bool interrupted, bool pageMuted);
-
     void captureDevicesChanged();
 
     WEBCORE_EXPORT static bool shouldInterruptAudioOnPageVisibilityChange();
index 303441d..a32628b 100644 (file)
@@ -60,11 +60,6 @@ public:
     virtual ~AudioCaptureFactory() = default;
     virtual CaptureSourceOrError createAudioCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0;
     virtual CaptureDeviceManager& audioCaptureDeviceManager() = 0;
-    virtual void setAudioCapturePageState(bool interrupted, bool pageMuted)
-    {
-        UNUSED_PARAM(interrupted);
-        UNUSED_PARAM(pageMuted);
-    }
 
 protected:
     AudioCaptureFactory() = default;
@@ -79,11 +74,6 @@ public:
     virtual ~VideoCaptureFactory() = default;
     virtual CaptureSourceOrError createVideoCaptureSource(const CaptureDevice&, String&&, const MediaConstraints*) = 0;
     virtual CaptureDeviceManager& videoCaptureDeviceManager() = 0;
-    virtual void setVideoCapturePageState(bool interrupted, bool pageMuted)
-    {
-        UNUSED_PARAM(interrupted);
-        UNUSED_PARAM(pageMuted);
-    }
 
 protected:
     VideoCaptureFactory() = default;
index bead3b9..ccce9b9 100644 (file)
@@ -41,7 +41,7 @@ private:
     explicit RealtimeVideoSource(Ref<RealtimeVideoCaptureSource>&&);
     ~RealtimeVideoSource();
 
-    // RealtimeVideoCaptureSource
+    // RealtimeMediaSiource
     void startProducingData() final;
     void stopProducingData() final;
     bool supportsSizeAndFrameRate(Optional<int> width, Optional<int> height, Optional<double> frameRate) final;
@@ -56,6 +56,7 @@ private:
     CaptureDevice::DeviceType deviceType() const final { return m_source->deviceType(); }
     void monitorOrientation(OrientationNotifier& notifier) final { m_source->monitorOrientation(notifier); }
     bool interrupted() const final { return m_source->interrupted(); }
+    bool isSameAs(RealtimeMediaSource& source) const final { return this == &source || m_source.ptr() == &source; }
 
     // Observer
     void sourceMutedChanged() final;
index 8d97041..4a2047b 100644 (file)
@@ -102,12 +102,6 @@ CoreAudioCaptureSourceFactory& CoreAudioCaptureSourceFactory::singleton()
     return factory.get();
 }
 
-void CoreAudioCaptureSourceFactory::setAudioCapturePageState(bool interrupted, bool pageMuted)
-{
-    if (auto* activeSource = this->activeSource())
-        activeSource->setInterrupted(interrupted, pageMuted);
-}
-
 }
 
 #endif // ENABLE(MEDIA_STREAM) && PLATFORM(IOS_FAMILY)
index e4e89bf..8d95282 100644 (file)
@@ -115,10 +115,6 @@ public:
 
     void devicesChanged(const Vector<CaptureDevice>&);
 
-#if PLATFORM(IOS_FAMILY)
-    void setAudioCapturePageState(bool interrupted, bool pageMuted) final;
-#endif
-
 private:
     CaptureSourceOrError createAudioCaptureSource(const CaptureDevice& device, String&& hashSalt, const MediaConstraints* constraints) final
     {
index 0bed589..3e3aa4e 100644 (file)
@@ -53,14 +53,6 @@ public:
     }
 
 private:
-#if PLATFORM(IOS_FAMILY)
-    void setVideoCapturePageState(bool interrupted, bool pageMuted)
-    {
-        if (activeSource())
-            activeSource()->setInterrupted(interrupted, pageMuted);
-    }
-#endif
-
     CaptureDeviceManager& videoCaptureDeviceManager() { return AVCaptureDeviceManager::singleton(); }
 };
 
index fc42f6b..724e153 100644 (file)
@@ -102,13 +102,6 @@ public:
     }
 
 private:
-#if PLATFORM(IOS_FAMILY)
-    void setVideoCapturePageState(bool interrupted, bool pageMuted) final
-    {
-        if (activeSource())
-            activeSource()->setInterrupted(interrupted, pageMuted);
-    }
-#endif
     CaptureDeviceManager& videoCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().videoCaptureDeviceManager(); }
 };
 
@@ -191,7 +184,6 @@ public:
     }
 private:
 #if PLATFORM(IOS_FAMILY)
-    void setAudioCapturePageState(bool interrupted, bool pageMuted) final { CoreAudioCaptureSourceFactory::singleton().setAudioCapturePageState(interrupted, pageMuted); }
     void setActiveSource(RealtimeMediaSource& source) final { CoreAudioCaptureSourceFactory::singleton().setActiveSource(source); }
     void unsetActiveSource(RealtimeMediaSource& source) final { CoreAudioCaptureSourceFactory::singleton().unsetActiveSource(source); }
     RealtimeMediaSource* activeSource() final { return CoreAudioCaptureSourceFactory::singleton().activeSource(); }
index ca3e438..b8f883b 100644 (file)
@@ -1,3 +1,16 @@
+2020-05-08  Youenn Fablet  <youenn@apple.com>
+
+        Video capture does not get unmuted in case of tab switch on iOS
+        https://bugs.webkit.org/show_bug.cgi?id=211509
+
+        Reviewed by Eric Carlson.
+
+        Remove no longer needed code.
+
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::VideoFactory::setActiveSource):
+        * WebProcess/cocoa/UserMediaCaptureManager.h:
+
 2020-05-08  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix GTK4 build after r261370
index 00cc23c..637ee91 100644 (file)
@@ -530,26 +530,10 @@ CaptureSourceOrError UserMediaCaptureManager::VideoFactory::createVideoCaptureSo
 }
 
 #if PLATFORM(IOS_FAMILY)
-void UserMediaCaptureManager::AudioFactory::setAudioCapturePageState(bool interrupted, bool pageMuted)
-{
-    if (auto* activeSource = this->activeSource())
-        activeSource->setInterrupted(interrupted, pageMuted);
-}
-
-void UserMediaCaptureManager::VideoFactory::setVideoCapturePageState(bool interrupted, bool pageMuted)
-{
-    // In case of cloning, we might have more than a single source.
-    for (auto& source : m_manager.m_sources.values()) {
-        if (source->deviceType() == CaptureDevice::DeviceType::Camera)
-            source->setInterrupted(interrupted, pageMuted);
-    }
-}
-
 void UserMediaCaptureManager::VideoFactory::setActiveSource(RealtimeMediaSource&)
 {
     // Muting is done by GPUProcess factory. We do not want to handle it here in case of track cloning.
 }
-
 #endif
 
 }
index 7256498..3bc51ea 100644 (file)
@@ -67,9 +67,6 @@ private:
     private:
         WebCore::CaptureSourceOrError createAudioCaptureSource(const WebCore::CaptureDevice&, String&& hashSalt, const WebCore::MediaConstraints*) final;
         WebCore::CaptureDeviceManager& audioCaptureDeviceManager() final { return m_manager.m_noOpCaptureDeviceManager; }
-#if PLATFORM(IOS_FAMILY)
-        void setAudioCapturePageState(bool interrupted, bool pageMuted) final;
-#endif
 
         UserMediaCaptureManager& m_manager;
         bool m_shouldCaptureInGPUProcess { false };
@@ -84,7 +81,6 @@ private:
         WebCore::CaptureDeviceManager& videoCaptureDeviceManager() final { return m_manager.m_noOpCaptureDeviceManager; }
 #if PLATFORM(IOS_FAMILY)
         void setActiveSource(WebCore::RealtimeMediaSource&) final;
-        void setVideoCapturePageState(bool interrupted, bool pageMuted) final;
 #endif
 
         UserMediaCaptureManager& m_manager;