Title: [261959] branches/safari-609-branch

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (261958 => 261959)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-05-20 21:30:01 UTC (rev 261959)
@@ -1,5 +1,22 @@
 2020-05-20  Russell Epstein  <[email protected]>
 
+        Apply patch. rdar://problem/63343507
+
+    2020-05-20  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-20  Russell Epstein  <[email protected]>
+
         Apply patch. rdar://problem/63393729
 
     2020-05-20  Youenn Fablet  <[email protected]>

Modified: branches/safari-609-branch/LayoutTests/platform/ios/TestExpectations (261958 => 261959)


--- branches/safari-609-branch/LayoutTests/platform/ios/TestExpectations	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/LayoutTests/platform/ios/TestExpectations	2020-05-20 21:30:01 UTC (rev 261959)
@@ -2927,6 +2927,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 ]
 
 webkit.org/b/177401 webrtc/captureCanvas-webrtc.html [ Pass Timeout Failure ]

Modified: branches/safari-609-branch/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html (261958 => 261959)


--- branches/safari-609-branch/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/LayoutTests/platform/ios/mediastream/video-muted-in-background-tab.html	2020-05-20 21:30:01 UTC (rev 261959)
@@ -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: branches/safari-609-branch/Source/WebCore/ChangeLog (261958 => 261959)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-20 21:30:01 UTC (rev 261959)
@@ -1,5 +1,41 @@
 2020-05-20  Russell Epstein  <[email protected]>
 
+        Apply patch. rdar://problem/63343507
+
+    2020-05-20  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.
+
+            Document is muting the capture video source in case of page being hidden.
+            When unhiding, only the RealtimeVideoSource is unmuted, not the capture video source (AVVideoCaptureSource).
+            Fort that reason, make sure to unmute the capture video source as well as the RealtimeVideoSource.
+            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.
+            Covered by updated test and manual testing.
+
+            * 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-20  Russell Epstein  <[email protected]>
+
         Apply patch. rdar://problem/63393729
 
     2020-05-20  Youenn Fablet  <[email protected]>

Modified: branches/safari-609-branch/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (261958 => 261959)


--- branches/safari-609-branch/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp	2020-05-20 21:30:01 UTC (rev 261959)
@@ -469,7 +469,7 @@
         if (captureTrack->document() != &document || captureTrack->ended())
             continue;
 
-        if (&captureTrack->source() == activeSource)
+        if (activeSource && captureTrack->source().isSameAs(*activeSource))
             return captureTrack;
 
         // If the document has a live capture track, which is not the active one, we pick the first one.
@@ -484,13 +484,19 @@
 void MediaStreamTrack::updateCaptureAccordingToMutedState(Document& document)
 {
 #if PLATFORM(IOS_FAMILY)
+    if (!document.page())
+        return;
+
     auto* activeAudioSource = RealtimeMediaSourceCenter::singleton().audioCaptureFactory().activeSource();
     if (auto* audioCaptureTrack = findActiveCaptureTrackForDocument(document, activeAudioSource, RealtimeMediaSource::Type::Audio))
         audioCaptureTrack->setMuted(document.page()->mutedState());
 
     auto* activeVideoSource = RealtimeMediaSourceCenter::singleton().videoCaptureFactory().activeSource();
-    if (auto* videoCaptureTrack = findActiveCaptureTrackForDocument(document, activeVideoSource, RealtimeMediaSource::Type::Video))
+    if (auto* videoCaptureTrack = findActiveCaptureTrackForDocument(document, activeVideoSource, RealtimeMediaSource::Type::Video)) {
         videoCaptureTrack->setMuted(document.page()->mutedState());
+        if (activeVideoSource && videoCaptureTrack->source().isSameAs(*activeVideoSource))
+            activeVideoSource->setMuted(document.page()->mutedState() & MediaProducer::AudioAndVideoCaptureIsMuted);
+    }
 #else
     for (auto* captureTrack : allCaptureTracks()) {
         if (captureTrack->document() != &document || captureTrack->ended())

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (261958 => 261959)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-05-20 21:30:01 UTC (rev 261959)
@@ -179,6 +179,7 @@
     virtual void monitorOrientation(OrientationNotifier&) { }
 
     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: branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeVideoSource.h (261958 => 261959)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2020-05-20 21:29:08 UTC (rev 261958)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeVideoSource.h	2020-05-20 21:30:01 UTC (rev 261959)
@@ -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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to