Diff
Modified: trunk/LayoutTests/ChangeLog (260012 => 260013)
--- trunk/LayoutTests/ChangeLog 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/LayoutTests/ChangeLog 2020-04-13 16:35:31 UTC (rev 260013)
@@ -1,3 +1,19 @@
+2020-04-13 Youenn Fablet <[email protected]>
+
+ Fix mute/unmute of CoreAudioCapture sources after revision 257914
+ https://bugs.webkit.org/show_bug.cgi?id=210381
+
+ Reviewed by Eric Carlson.
+
+ Clone tests for having both GPU and non GPU test runs.
+
+ * platform/ios/mediastream/audio-muted-in-background-tab-gpu-process-expected.txt: Added.
+ * platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html: Copied from LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab.html.
+ * platform/ios/mediastream/audio-muted-in-background-tab.html:
+ * platform/ios/mediastream/getUserMedia-single-capture-gpu-process-expected.txt: Added.
+ * platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html: Copied from LayoutTests/platform/ios/mediastream/getUserMedia-single-capture.html.
+ * platform/ios/mediastream/getUserMedia-single-capture.html:
+
2020-04-13 Zalan Bujtas <[email protected]>
[LFC][TFC] Pre-fill columnIntrinsicWidths vector
Added: trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process-expected.txt (0 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process-expected.txt 2020-04-13 16:35:31 UTC (rev 260013)
@@ -0,0 +1,7 @@
+
+PASS Setup stream
+PASS Hide page, video and audio should be muted
+PASS Show page, video and audio should be unmuted
+PASS Hide and mute page, video and audio should be muted
+PASS Show page, video and audio should remain muted
+
Copied: trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html (from rev 260012, trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab.html) (0 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html (rev 0)
+++ trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html 2020-04-13 16:35:31 UTC (rev 260013)
@@ -0,0 +1,72 @@
+<!-- webkit-test-runner [ enableCaptureAudioInGPUProcess=true enableCaptureVideoInGPUProcess=true ] -->
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Don't unmute audio when a tab becomes visible unless it was muted when the tab was hidden</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+ let audioTrack;
+ let videoTrack;
+
+ promise_test((t) => {
+ if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+ if (!window.internals)
+ return Promise.reject("this test needs internals API");
+
+ internals.setShouldInterruptAudioOnPageVisibilityChange(true);
+
+ return navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then((stream) => {
+ audioTrack = stream.getAudioTracks()[0];
+ videoTrack = stream.getVideoTracks()[0];
+
+ 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);
+ assert_true(audioTrack.muted, "audio track is muted");
+ assert_true(videoTrack.muted, "video track is muted");
+ }, "Hide page, video and audio 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");
+ })
+
+ .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");
+ })
+
+ .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");
+
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab.html (260012 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab.html 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/LayoutTests/platform/ios/mediastream/audio-muted-in-background-tab.html 2020-04-13 16:35:31 UTC (rev 260013)
@@ -1,4 +1,4 @@
-
+<!-- webkit-test-runner [ enableCaptureAudioInGPUProcess=false enableCaptureVideoInGPUProcess=false ] -->
<!doctype html>
<html>
<head>
Added: trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process-expected.txt (0 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process-expected.txt 2020-04-13 16:35:31 UTC (rev 260013)
@@ -0,0 +1,3 @@
+
+PASS Testing successive getUserMedia calls
+
Copied: trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html (from rev 260012, trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture.html) (0 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html (rev 0)
+++ trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html 2020-04-13 16:35:31 UTC (rev 260013)
@@ -0,0 +1,53 @@
+<!-- webkit-test-runner [ enableCaptureAudioInGPUProcess=true enableCaptureVideoInGPUProcess=true ] -->
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>iOS specific constraints of one active capture source at a time</title>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+
+async function waitForTrackMuted(track)
+{
+ if (track.muted)
+ return;
+
+ return new Promise(resolve => track._onmute_ = resolve);
+}
+
+promise_test((test) => {
+ if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+
+ var firstStream;
+ var audioTrack;
+ var videoTrack;
+ return navigator.mediaDevices.getUserMedia({ audio: true, video: { facingMode: { exact: ['user'] } } }).then((stream) => {
+ firstStream = stream;
+ audioTrack = firstStream.getAudioTracks()[0];
+ videoTrack = firstStream.getVideoTracks()[0];
+
+ assert_false(audioTrack.muted, "audio track is active");
+ assert_false(videoTrack.muted, "video track is active");
+
+ return navigator.mediaDevices.getUserMedia({ audio: true});
+ }).then(async (stream) => {
+ await waitForTrackMuted(audioTrack);
+
+ assert_true(audioTrack.muted, "audio track is muted");
+ assert_false(videoTrack.muted, "video track is active");
+
+ return navigator.mediaDevices.getUserMedia({ video: { facingMode: { exact: ["environment"] } } });
+ }).then(async (stream) => {
+ await waitForTrackMuted(videoTrack);
+
+ assert_true(audioTrack.muted, "audio track is muted, second check");
+ assert_true(videoTrack.muted, "video track is muted");
+ });
+}, "Testing successive getUserMedia calls");
+ </script>
+ </body>
+</html>
Modified: trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture.html (260012 => 260013)
--- trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture.html 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/LayoutTests/platform/ios/mediastream/getUserMedia-single-capture.html 2020-04-13 16:35:31 UTC (rev 260013)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCaptureAudioInGPUProcess=false enableCaptureVideoInGPUProcess=false ] -->
<!doctype html>
<html>
<head>
@@ -43,7 +44,7 @@
}).then(async (stream) => {
await waitForTrackMuted(videoTrack);
- assert_true(audioTrack.muted, "audio track is muted");
+ assert_true(audioTrack.muted, "audio track is muted, second check");
assert_true(videoTrack.muted, "video track is muted");
});
}, "Testing successive getUserMedia calls");
Modified: trunk/Source/WebCore/ChangeLog (260012 => 260013)
--- trunk/Source/WebCore/ChangeLog 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/Source/WebCore/ChangeLog 2020-04-13 16:35:31 UTC (rev 260013)
@@ -1,3 +1,23 @@
+2020-04-13 Youenn Fablet <[email protected]>
+
+ Fix mute/unmute of CoreAudioCapture sources after revision 257914
+ https://bugs.webkit.org/show_bug.cgi?id=210381
+
+ Reviewed by Eric Carlson.
+
+ Revert part of revision 257914 since we still need the active source registration/unregistration when capturing in web process.
+ Make sure mock factory delegates all active source handling to CoreAudioCaptureSourceFactory,
+ now that the mock factory is using CoreAudioCaptureSources with a mock share dunit.
+
+ Tests: platform/ios/mediastream/audio-muted-in-background-tab-gpu-process.html
+ platform/ios/mediastream/getUserMedia-single-capture-gpu-process.html
+
+ * platform/mediastream/RealtimeMediaSourceFactory.h:
+ * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+ (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
+ (WebCore::CoreAudioCaptureSource::startProducingData):
+ * platform/mock/MockRealtimeMediaSourceCenter.cpp:
+
2020-04-13 Michael Catanzaro <[email protected]>
Fix various build warnings
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h (260012 => 260013)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceFactory.h 2020-04-13 16:35:31 UTC (rev 260013)
@@ -43,9 +43,9 @@
virtual ~SingleSourceFactory() = default;
virtual void setActiveSource(RealtimeMediaSource&);
- void unsetActiveSource(RealtimeMediaSource&);
+ virtual void unsetActiveSource(RealtimeMediaSource&);
- RealtimeMediaSource* activeSource() { return m_activeSource; }
+ virtual RealtimeMediaSource* activeSource() { return m_activeSource; }
private:
RealtimeMediaSource* m_activeSource { nullptr };
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (260012 => 260013)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2020-04-13 16:35:31 UTC (rev 260013)
@@ -726,11 +726,19 @@
CoreAudioCaptureSource::~CoreAudioCaptureSource()
{
+#if PLATFORM(IOS_FAMILY)
+ CoreAudioCaptureSourceFactory::singleton().unsetActiveSource(*this);
+#endif
+
unit().removeClient(*this);
}
void CoreAudioCaptureSource::startProducingData()
{
+#if PLATFORM(IOS_FAMILY)
+ CoreAudioCaptureSourceFactory::singleton().setActiveSource(*this);
+#endif
+
initializeToStartProducingData();
unit().startProducingData();
}
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp (260012 => 260013)
--- trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp 2020-04-13 16:33:31 UTC (rev 260012)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp 2020-04-13 16:35:31 UTC (rev 260013)
@@ -135,7 +135,7 @@
CaptureDeviceManager& displayCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().displayCaptureDeviceManager(); }
};
-class MockRealtimeAudioSourceFactory : public AudioCaptureFactory {
+class MockRealtimeAudioSourceFactory final : public AudioCaptureFactory {
public:
CaptureSourceOrError createAudioCaptureSource(const CaptureDevice& device, String&& hashSalt, const MediaConstraints* constraints) final
{
@@ -148,6 +148,9 @@
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(); }
#endif
CaptureDeviceManager& audioCaptureDeviceManager() final { return MockRealtimeMediaSourceCenter::singleton().audioCaptureDeviceManager(); }
};