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

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (262880 => 262881)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-06-11 00:35:56 UTC (rev 262881)
@@ -1,3 +1,15 @@
+2020-06-10  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/64226920
+
+    2020-06-10  Youenn Fablet  <you...@apple.com>
+
+            BaseAudioSharedUnit should unmute its clients in case of suspension even if not having any audio unit
+            https://bugs.webkit.org/show_bug.cgi?id=212970
+
+            * fast/mediastream/media-stream-track-interrupted-expected.txt:
+            * fast/mediastream/media-stream-track-interrupted.html:
+
 2020-06-06  Andy Estes  <aes...@apple.com>
 
         Unreviewed test gardening.

Modified: branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt (262880 => 262881)


--- branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt	2020-06-11 00:35:56 UTC (rev 262881)
@@ -1,5 +1,5 @@
 
-
+PASS Suspend/resume audio track 
 PASS Create stream 
 PASS Interrupt video track 
 PASS Interrupt audio track 

Modified: branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted.html (262880 => 262881)


--- branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted.html	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/LayoutTests/fast/mediastream/media-stream-track-interrupted.html	2020-06-11 00:35:56 UTC (rev 262881)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCaptureAudioInUIProcess=false ] -->
 <!DOCTYPE html>
 <html>
 <head>
@@ -7,15 +8,30 @@
     <script src=""
  </head>
 <body>
-    <video width=320 height=240></video>
-
     <script>
+    promise_test(async (test) => {
+        const stream = await navigator.mediaDevices.getUserMedia({audio: true});
+        const track = stream.getAudioTracks()[0];
+        if (!window.internals)
+            return;
 
-    let video;
+        let promise = new Promise((resolve, reject) => { track._onmute_ = resolve; setTimeout(() => reject("no mute"), 5000) });
+        internals.setMediaStreamSourceInterrupted(track, true);
+        await promise;
 
-   if (window.testRunner)
-        testRunner.setUserMediaPermission(true);
+        assert_true(track.muted, "track is muted");
+        assert_true(internals.isMediaStreamSourceInterrupted(track), "source is interrupted");
 
+        promise = new Promise((resolve, reject) => { track._onunmute_ = resolve; setTimeout(() => reject("no unmute"), 5000) });
+        internals.setMediaStreamSourceInterrupted(track, false);
+        await promise;
+
+        assert_false(track.muted, "track is no longer muted");
+        assert_false(internals.isMediaStreamSourceInterrupted(track), "source is not interrupted");
+
+        track.stop();
+    }, "Suspend/resume audio track");
+
     function waitForPageStateChange(numberOfTries, originalState, resolve, reject)
     {
         let newState = internals.pageMediaState();
@@ -80,7 +96,6 @@
             });
     }, "Create stream");
 
-
     </script>
 
 </body>

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-06-11 00:35:56 UTC (rev 262881)
@@ -1,3 +1,33 @@
+2020-06-10  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/64226920
+
+    2020-06-10  Youenn Fablet  <you...@apple.com>
+
+            BaseAudioSharedUnit should unmute its clients in case of suspension even if not having any audio unit
+            https://bugs.webkit.org/show_bug.cgi?id=212970
+
+            CoreAudioCaptureSource(s), when muted, are now calling stopProducingData.
+            This will, in turn, make the BaseAudioSharedUnit stop and no longer have any audio unit.
+            In that case, when resume is called on the BaseAudioSharedUnit, it will exit early as the audio unit is null.
+            This will prevent to unmute the CoreAudioCaptureSource(s).
+
+            Fix this by removing the audio unit check in BaseAudioSharedUnit::resume.
+            Add infrastructure testing to be able to write a test.
+
+            Covered by added test.
+
+            * platform/mediastream/RealtimeMediaSource.h:
+            * platform/mediastream/mac/BaseAudioSharedUnit.cpp:
+            (WebCore::BaseAudioSharedUnit::resume):
+            * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+            (WebCore::CoreAudioCaptureSource::setInterruptedForTesting):
+            * platform/mediastream/mac/CoreAudioCaptureSource.h:
+            * testing/Internals.cpp:
+            (WebCore::Internals::isMediaStreamSourceInterrupted const):
+            * testing/Internals.h:
+            * testing/Internals.idl:
+
 2020-06-09  Dean Jackson  <d...@apple.com>
 
         REGRESSION: [Safari Mojave for High Sierra] Accessing some of the featured pages on apple.com causes the webpage to crash

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


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/RealtimeMediaSource.h	2020-06-11 00:35:56 UTC (rev 262881)
@@ -195,7 +195,7 @@
 
     // Testing only
     virtual void delaySamples(Seconds) { };
-    void setInterruptedForTesting(bool);
+    virtual void setInterruptedForTesting(bool);
 
 protected:
     RealtimeMediaSource(Type, String&& name, String&& deviceID = { }, String&& hashSalt = { });

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp	2020-06-11 00:35:56 UTC (rev 262881)
@@ -172,9 +172,7 @@
         reconfigure();
     }
 
-    if (!hasAudioUnit())
-        return 0;
-
+    ASSERT(!m_producingCount);
     if (m_producingCount) {
         if (auto error = startUnit())
             return error;

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp	2020-06-11 00:35:56 UTC (rev 262881)
@@ -633,6 +633,15 @@
     return m_overrideUnit ? *m_overrideUnit : CoreAudioSharedUnit::singleton();
 }
 
+void CoreAudioCaptureSource::setInterruptedForTesting(bool isInterrupted)
+{
+    if (isInterrupted) {
+        unit().suspend();
+        return;
+    }
+    unit().resume();
+}
+
 void CoreAudioCaptureSourceFactory::beginInterruption()
 {
     if (!isMainThread()) {

Modified: branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h	2020-06-11 00:35:56 UTC (rev 262881)
@@ -78,6 +78,7 @@
     void stopProducingData() final;
 
     void delaySamples(Seconds) final;
+    void setInterruptedForTesting(bool) final;
 
     Optional<Vector<int>> discreteSampleRates() const final { return { { 8000, 16000, 32000, 44100, 48000, 96000 } }; }
 

Modified: branches/safari-609-branch/Source/WebCore/testing/Internals.cpp (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.cpp	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.cpp	2020-06-11 00:35:56 UTC (rev 262881)
@@ -4943,6 +4943,11 @@
     track.source().setInterruptedForTesting(interrupted);
 }
 
+bool Internals::isMediaStreamSourceInterrupted(MediaStreamTrack& track) const
+{
+    return track.source().interrupted();
+}
+
 bool Internals::isMockRealtimeMediaSourceCenterEnabled()
 {
     return MockRealtimeMediaSourceCenter::mockRealtimeMediaSourceCenterEnabled();

Modified: branches/safari-609-branch/Source/WebCore/testing/Internals.h (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.h	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.h	2020-06-11 00:35:56 UTC (rev 262881)
@@ -750,6 +750,7 @@
     void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack&);
     void setMediaStreamTrackIdentifier(MediaStreamTrack&, String&& id);
     void setMediaStreamSourceInterrupted(MediaStreamTrack&, bool);
+    bool isMediaStreamSourceInterrupted(MediaStreamTrack&) const;
     bool isMockRealtimeMediaSourceCenterEnabled();
 #endif
 

Modified: branches/safari-609-branch/Source/WebCore/testing/Internals.idl (262880 => 262881)


--- branches/safari-609-branch/Source/WebCore/testing/Internals.idl	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Source/WebCore/testing/Internals.idl	2020-06-11 00:35:56 UTC (rev 262881)
@@ -727,6 +727,7 @@
     [Conditional=MEDIA_STREAM] void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack track);
     [Conditional=MEDIA_STREAM] void setMediaStreamTrackIdentifier(MediaStreamTrack track, DOMString identifier);
     [Conditional=MEDIA_STREAM] void setMediaStreamSourceInterrupted(MediaStreamTrack track, boolean interrupted);
+    [Conditional=MEDIA_STREAM] boolean isMediaStreamSourceInterrupted(MediaStreamTrack track);
     [Conditional=MEDIA_STREAM] boolean isMockRealtimeMediaSourceCenterEnabled();
 
     unsigned long long documentIdentifier(Document document);

Modified: branches/safari-609-branch/Tools/ChangeLog (262880 => 262881)


--- branches/safari-609-branch/Tools/ChangeLog	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Tools/ChangeLog	2020-06-11 00:35:56 UTC (rev 262881)
@@ -1,3 +1,21 @@
+2020-06-10  Alan Coon  <alanc...@apple.com>
+
+        Apply patch. rdar://problem/64226920
+
+    2020-06-10  Youenn Fablet  <you...@apple.com>
+
+            BaseAudioSharedUnit should unmute its clients in case of suspension even if not having any audio unit
+            https://bugs.webkit.org/show_bug.cgi?id=212970
+
+            Add an option to capture in UI process so that the same test can run on both MacOS and iOS.
+            This eases the testing infra to be able to get audio capture unit state in WebProcess as is the case in iOS.
+
+            * WebKitTestRunner/TestController.cpp:
+            (WTR::TestController::resetPreferencesToConsistentValues):
+            (WTR::updateTestOptionsFromTestHeader):
+            * WebKitTestRunner/TestOptions.h:
+            (WTR::TestOptions::hasSameInitializationOptions const):
+
 2020-06-08  Alex Christensen  <achristen...@webkit.org>
 
         Fix branch build after r262552

Modified: branches/safari-609-branch/Tools/WebKitTestRunner/TestController.cpp (262880 => 262881)


--- branches/safari-609-branch/Tools/WebKitTestRunner/TestController.cpp	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Tools/WebKitTestRunner/TestController.cpp	2020-06-11 00:35:56 UTC (rev 262881)
@@ -821,6 +821,7 @@
 
 #if PLATFORM(COCOA)
     WKPreferencesSetCaptureVideoInUIProcessEnabled(preferences, options.enableCaptureVideoInUIProcess);
+    WKPreferencesSetCaptureAudioInUIProcessEnabled(preferences, options.enableCaptureAudioInUIProcess);
     WKPreferencesSetCaptureAudioInGPUProcessEnabled(preferences, options.enableCaptureAudioInGPUProcess);
 #endif
     WKPreferencesSetProcessSwapOnNavigationEnabled(preferences, options.contextOptions.shouldEnableProcessSwapOnNavigation());
@@ -1464,6 +1465,8 @@
             testOptions.allowsLinkPreview = parseBooleanTestHeaderValue(value);
         else if (key == "enableCaptureVideoInUIProcess")
             testOptions.enableCaptureVideoInUIProcess = parseBooleanTestHeaderValue(value);
+        else if (key == "enableCaptureAudioInUIProcess")
+            testOptions.enableCaptureAudioInUIProcess = parseBooleanTestHeaderValue(value);
         else if (key == "enableCaptureAudioInGPUProcess")
             testOptions.enableCaptureAudioInGPUProcess = parseBooleanTestHeaderValue(value);
         pairStart = pairEnd + 1;

Modified: branches/safari-609-branch/Tools/WebKitTestRunner/TestOptions.h (262880 => 262881)


--- branches/safari-609-branch/Tools/WebKitTestRunner/TestOptions.h	2020-06-11 00:33:24 UTC (rev 262880)
+++ branches/safari-609-branch/Tools/WebKitTestRunner/TestOptions.h	2020-06-11 00:35:56 UTC (rev 262881)
@@ -99,6 +99,7 @@
     bool enableLazyImageLoading { false };
     bool allowsLinkPreview { true };
     bool enableCaptureVideoInUIProcess { false };
+    bool enableCaptureAudioInUIProcess { false };
     bool enableCaptureAudioInGPUProcess { false };
 
     double contentInsetTop { 0 };
@@ -162,6 +163,7 @@
             || enableLazyImageLoading != options.enableLazyImageLoading
             || allowsLinkPreview != options.allowsLinkPreview
             || enableCaptureVideoInUIProcess != options.enableCaptureVideoInUIProcess
+            || enableCaptureAudioInUIProcess != options.enableCaptureAudioInUIProcess
             || enableCaptureAudioInGPUProcess != options.enableCaptureAudioInGPUProcess)
             return false;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to