Diff
Modified: trunk/LayoutTests/ChangeLog (262797 => 262798)
--- trunk/LayoutTests/ChangeLog 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/LayoutTests/ChangeLog 2020-06-09 18:16:08 UTC (rev 262798)
@@ -1,3 +1,13 @@
+2020-06-09 Youenn Fablet <[email protected]>
+
+ 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
+
+ Reviewed by Eric Carlson.
+
+ * fast/mediastream/media-stream-track-interrupted-expected.txt:
+ * fast/mediastream/media-stream-track-interrupted.html:
+
2020-06-09 Diego Pino Garcia <[email protected]>
[GTK] Gardening, remove flaky timeout failures after r262789
Modified: trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt (262797 => 262798)
--- trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted-expected.txt 2020-06-09 18:16:08 UTC (rev 262798)
@@ -1,5 +1,5 @@
-
+PASS Suspend/resume audio track
PASS Create stream
PASS Interrupt video track
PASS Interrupt audio track
Modified: trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted.html (262797 => 262798)
--- trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted.html 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/LayoutTests/fast/mediastream/media-stream-track-interrupted.html 2020-06-09 18:16:08 UTC (rev 262798)
@@ -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: trunk/Source/WebCore/ChangeLog (262797 => 262798)
--- trunk/Source/WebCore/ChangeLog 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/ChangeLog 2020-06-09 18:16:08 UTC (rev 262798)
@@ -1,3 +1,31 @@
+2020-06-09 Youenn Fablet <[email protected]>
+
+ 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
+
+ Reviewed by Eric Carlson.
+
+ 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 Myles C. Maxfield <[email protected]>
lang=zh needs to defer to system preferences to know whether it should be simplified or traditional
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (262797 => 262798)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2020-06-09 18:16:08 UTC (rev 262798)
@@ -214,7 +214,7 @@
// Testing only
virtual void delaySamples(Seconds) { };
- void setInterruptedForTesting(bool);
+ virtual void setInterruptedForTesting(bool);
virtual bool setShouldApplyRotation(bool) { return false; }
Modified: trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp (262797 => 262798)
--- trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/platform/mediastream/mac/BaseAudioSharedUnit.cpp 2020-06-09 18:16:08 UTC (rev 262798)
@@ -176,9 +176,7 @@
reconfigure();
}
- if (!hasAudioUnit())
- return 0;
-
+ ASSERT(!m_producingCount);
if (m_producingCount) {
if (auto error = startUnit())
return error;
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (262797 => 262798)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2020-06-09 18:16:08 UTC (rev 262798)
@@ -635,6 +635,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: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h (262797 => 262798)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h 2020-06-09 18:16:08 UTC (rev 262798)
@@ -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: trunk/Source/WebCore/testing/Internals.cpp (262797 => 262798)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-06-09 18:16:08 UTC (rev 262798)
@@ -5173,6 +5173,11 @@
track.source().setInterruptedForTesting(interrupted);
}
+bool Internals::isMediaStreamSourceInterrupted(MediaStreamTrack& track) const
+{
+ return track.source().interrupted();
+}
+
bool Internals::isMockRealtimeMediaSourceCenterEnabled()
{
return MockRealtimeMediaSourceCenter::mockRealtimeMediaSourceCenterEnabled();
Modified: trunk/Source/WebCore/testing/Internals.h (262797 => 262798)
--- trunk/Source/WebCore/testing/Internals.h 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/testing/Internals.h 2020-06-09 18:16:08 UTC (rev 262798)
@@ -785,6 +785,7 @@
void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack&);
void setMediaStreamTrackIdentifier(MediaStreamTrack&, String&& id);
void setMediaStreamSourceInterrupted(MediaStreamTrack&, bool);
+ bool isMediaStreamSourceInterrupted(MediaStreamTrack&) const;
bool isMockRealtimeMediaSourceCenterEnabled();
bool shouldAudioTrackPlay(const AudioTrack&);
#endif
Modified: trunk/Source/WebCore/testing/Internals.idl (262797 => 262798)
--- trunk/Source/WebCore/testing/Internals.idl 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-06-09 18:16:08 UTC (rev 262798)
@@ -784,6 +784,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();
[Conditional=MEDIA_STREAM] boolean shouldAudioTrackPlay(AudioTrack track);
Modified: trunk/Tools/ChangeLog (262797 => 262798)
--- trunk/Tools/ChangeLog 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Tools/ChangeLog 2020-06-09 18:16:08 UTC (rev 262798)
@@ -1,3 +1,19 @@
+2020-06-09 Youenn Fablet <[email protected]>
+
+ 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
+
+ Reviewed by Eric Carlson.
+
+ 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-09 Takashi Komori <[email protected]>
[Curl] Implement functions to use ResourceLoadStatistics.
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (262797 => 262798)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2020-06-09 18:16:08 UTC (rev 262798)
@@ -853,6 +853,7 @@
#if PLATFORM(COCOA)
WKPreferencesSetCaptureVideoInUIProcessEnabled(preferences, options.enableCaptureVideoInUIProcess);
WKPreferencesSetCaptureVideoInGPUProcessEnabled(preferences, options.enableCaptureVideoInGPUProcess);
+ WKPreferencesSetCaptureAudioInUIProcessEnabled(preferences, options.enableCaptureAudioInUIProcess);
WKPreferencesSetCaptureAudioInGPUProcessEnabled(preferences, options.enableCaptureAudioInGPUProcess);
#endif
WKPreferencesSetProcessSwapOnNavigationEnabled(preferences, options.contextOptions.shouldEnableProcessSwapOnNavigation());
@@ -1535,6 +1536,8 @@
testOptions.enableCaptureVideoInUIProcess = parseBooleanTestHeaderValue(value);
else if (key == "enableCaptureVideoInGPUProcess")
testOptions.enableCaptureVideoInGPUProcess = parseBooleanTestHeaderValue(value);
+ else if (key == "enableCaptureAudioInUIProcess")
+ testOptions.enableCaptureAudioInUIProcess = parseBooleanTestHeaderValue(value);
else if (key == "enableCaptureAudioInGPUProcess")
testOptions.enableCaptureAudioInGPUProcess = parseBooleanTestHeaderValue(value);
else if (key == "allowTopNavigationToDataURLs")
Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (262797 => 262798)
--- trunk/Tools/WebKitTestRunner/TestOptions.h 2020-06-09 18:15:16 UTC (rev 262797)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h 2020-06-09 18:16:08 UTC (rev 262798)
@@ -101,6 +101,7 @@
bool allowsLinkPreview { true };
bool enableCaptureVideoInUIProcess { false };
bool enableCaptureVideoInGPUProcess { false };
+ bool enableCaptureAudioInUIProcess { false };
bool enableCaptureAudioInGPUProcess { false };
bool allowTopNavigationToDataURLs { true };
bool enableInAppBrowserPrivacy { false };
@@ -170,6 +171,7 @@
|| allowsLinkPreview != options.allowsLinkPreview
|| enableCaptureVideoInUIProcess != options.enableCaptureVideoInUIProcess
|| enableCaptureVideoInGPUProcess != options.enableCaptureVideoInGPUProcess
+ || enableCaptureAudioInUIProcess != options.enableCaptureAudioInUIProcess
|| enableCaptureAudioInGPUProcess != options.enableCaptureAudioInGPUProcess
|| allowTopNavigationToDataURLs != options.allowTopNavigationToDataURLs
|| enableInAppBrowserPrivacy != options.enableInAppBrowserPrivacy