Title: [261373] trunk
Revision
261373
Author
[email protected]
Date
2020-05-08 03:54:07 -0700 (Fri, 08 May 2020)

Log Message

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.

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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261372 => 261373)


--- trunk/LayoutTests/ChangeLog	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/LayoutTests/ChangeLog	2020-05-08 10:54:07 UTC (rev 261373)
@@ -1,3 +1,16 @@
+2020-05-08  Youenn Fablet  <[email protected]>
+
+        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  <[email protected]>
 
         [GTK][WPE] Gardening, update expectations and baselines after r261341

Modified: trunk/LayoutTests/platform/ios/TestExpectations (261372 => 261373)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-05-08 10:54:07 UTC (rev 261373)
@@ -2880,6 +2880,8 @@
 
 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 ]

Modified: trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html (261372 => 261373)


--- trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-05-08 10:54:07 UTC (rev 261373)
@@ -12,6 +12,20 @@
             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);
@@ -25,46 +39,40 @@
                     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>

Modified: trunk/Source/WebCore/ChangeLog (261372 => 261373)


--- trunk/Source/WebCore/ChangeLog	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/ChangeLog	2020-05-08 10:54:07 UTC (rev 261373)
@@ -1,3 +1,36 @@
+2020-05-08  Youenn Fablet  <[email protected]>
+
+        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  <[email protected]>
 
         MayBegin wheel event in a <select> doesn't flash the scrollers

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (261372 => 261373)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -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 @@
 {
     auto track = adoptRef(*new MediaStreamTrack(context, WTFMove(privateTrack)));
     track->suspendIfNeeded();
+
+    if (track->isCaptureTrack())
+        track->updateToPageMutedState();
+
     return track;
 }
 
@@ -87,11 +92,6 @@
 
     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 @@
     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,22 +448,16 @@
 }
 
 #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
 
@@ -490,22 +464,51 @@
 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;

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h (261372 => 261373)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -87,7 +87,6 @@
     void setEnabled(bool);
 
     bool muted() const;
-    void setMuted(MediaProducer::MutedStateFlags);
 
     enum class State { Live, Ended };
     State readyState() const;
@@ -169,6 +168,7 @@
     explicit MediaStreamTrack(MediaStreamTrack&);
 
     void configureTrackRendering();
+    void updateToPageMutedState();
 
     // ActiveDOMObject API.
     void stop() final { stopTrack(); }

Modified: trunk/Source/WebCore/dom/Document.cpp (261372 => 261373)


--- trunk/Source/WebCore/dom/Document.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -1749,17 +1749,10 @@
     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

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -88,16 +88,6 @@
         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);

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -127,7 +127,6 @@
     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 @@
 
     virtual void captureFailed();
 
+    virtual bool isSameAs(RealtimeMediaSource& source) const { return this == &source; }
     virtual bool isIncomingAudioSource() const { return false; }
     virtual bool isIncomingVideoSource() const { return false; }
 

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -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 @@
     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;

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -86,8 +86,6 @@
 
     WEBCORE_EXPORT void setDevicesChangedObserver(std::function<void()>&&);
 
-    void setCapturePageState(bool interrupted, bool pageMuted);
-
     void captureDevicesChanged();
 
     WEBCORE_EXPORT static bool shouldInterruptAudioOnPageVisibilityChange();

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -60,11 +60,6 @@
     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 @@
     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;

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -41,7 +41,7 @@
     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 @@
     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;

Modified: trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm	2020-05-08 10:54:07 UTC (rev 261373)
@@ -102,12 +102,6 @@
     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)

Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -115,10 +115,6 @@
 
     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
     {

Modified: trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp (261372 => 261373)


--- trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -53,14 +53,6 @@
     }
 
 private:
-#if PLATFORM(IOS_FAMILY)
-    void setVideoCapturePageState(bool interrupted, bool pageMuted)
-    {
-        if (activeSource())
-            activeSource()->setInterrupted(interrupted, pageMuted);
-    }
-#endif
-
     CaptureDeviceManager& videoCaptureDeviceManager() { return AVCaptureDeviceManager::singleton(); }
 };
 

Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp (261372 => 261373)


--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -102,13 +102,6 @@
     }
 
 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 @@
     }
 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(); }

Modified: trunk/Source/WebKit/ChangeLog (261372 => 261373)


--- trunk/Source/WebKit/ChangeLog	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebKit/ChangeLog	2020-05-08 10:54:07 UTC (rev 261373)
@@ -1,3 +1,16 @@
+2020-05-08  Youenn Fablet  <[email protected]>
+
+        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  <[email protected]>
 
         Unreviewed. Fix GTK4 build after r261370

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp (261372 => 261373)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-05-08 10:54:07 UTC (rev 261373)
@@ -530,26 +530,10 @@
 }
 
 #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
 
 }

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h (261372 => 261373)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h	2020-05-08 10:23:22 UTC (rev 261372)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.h	2020-05-08 10:54:07 UTC (rev 261373)
@@ -67,9 +67,6 @@
     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 @@
         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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to