Diff
Modified: trunk/LayoutTests/ChangeLog (252680 => 252681)
--- trunk/LayoutTests/ChangeLog 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/ChangeLog 2019-11-20 04:10:24 UTC (rev 252681)
@@ -1,3 +1,19 @@
+2019-11-19 Youenn Fablet <you...@apple.com>
+
+ getUserMedia echoCancellation constraint has no affect
+ https://bugs.webkit.org/show_bug.cgi?id=179411
+
+ Reviewed by Eric Carlson.
+
+ * fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt:
+ * fast/mediastream/MediaDevices-getSupportedConstraints.html:
+ * fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt:
+ * fast/mediastream/apply-constraints-audio-expected.txt:
+ * fast/mediastream/apply-constraints-audio.html:
+ * fast/mediastream/getUserMedia-webaudio-expected.txt:
+ * fast/mediastream/getUserMedia-webaudio.html:
+ * webrtc/routines.js:
+
2019-11-19 Peng Liu <peng.l...@apple.com>
Typos in layout test names
Modified: trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints-expected.txt 2019-11-20 04:10:24 UTC (rev 252681)
@@ -10,7 +10,7 @@
PASS supportedConstraints.aspectRatio is true
PASS supportedConstraints.deviceId is true
-PASS supportedConstraints.echoCancellation is false
+PASS supportedConstraints.echoCancellation is true
PASS supportedConstraints.facingMode is true
PASS supportedConstraints.frameRate is true
PASS supportedConstraints.groupId is false
Modified: trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints.html (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints.html 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/MediaDevices-getSupportedConstraints.html 2019-11-20 04:10:24 UTC (rev 252681)
@@ -20,7 +20,7 @@
debug("");
shouldBeTrue("supportedConstraints.aspectRatio");
shouldBeTrue("supportedConstraints.deviceId");
- shouldBeFalse("supportedConstraints.echoCancellation");
+ shouldBeTrue("supportedConstraints.echoCancellation");
shouldBeTrue("supportedConstraints.facingMode");
shouldBeTrue("supportedConstraints.frameRate");
shouldBeFalse("supportedConstraints.groupId");
Modified: trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/MediaStreamTrack-getCapabilities-expected.txt 2019-11-20 04:10:24 UTC (rev 252681)
@@ -13,7 +13,7 @@
audio track capabilities:
capabilities.deviceId = <UUID>
- capabilities.echoCancellation = [ true, true ]
+ capabilities.echoCancellation = [ true, false ]
capabilities.sampleRate = { max: 48000, min: 44100 }
capabilities.volume = { max: 1, min: 0 }
Modified: trunk/LayoutTests/fast/mediastream/apply-constraints-audio-expected.txt (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/apply-constraints-audio-expected.txt 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/apply-constraints-audio-expected.txt 2019-11-20 04:10:24 UTC (rev 252681)
@@ -11,7 +11,7 @@
** Constraint: {"volume":0.5} - set volume to a valid value.
PASS settings['volume'] is 0.5
PASS typeof settings['echoCancellation'] is 'boolean'
-PASS settings['echoCancellation'] is false
+PASS settings['echoCancellation'] is true
** Constraint: {"volume":{"exact":2.1}} - the 'exact' constraint it too big, promise should reject and no settings should change.
PASS Promise was rejected
@@ -18,7 +18,7 @@
PASS error.constraint is "volume"
PASS settings['volume'] is 0.5
PASS typeof settings['echoCancellation'] is 'boolean'
-PASS settings['echoCancellation'] is false
+PASS settings['echoCancellation'] is true
** Constraint: {"volume":{"exact":-1}} - the 'exact' constraint it too small, promise should reject and no settings should change.
PASS Promise was rejected
@@ -25,17 +25,17 @@
PASS error.constraint is "volume"
PASS settings['volume'] is 0.5
PASS typeof settings['echoCancellation'] is 'boolean'
-PASS settings['echoCancellation'] is false
+PASS settings['echoCancellation'] is true
-** Constraint: {"echoCancellation":true} - set echoCancellation to a valid value.
+** Constraint: {"echoCancellation":false} - set echoCancellation to a valid value.
PASS settings['volume'] is 0.5
PASS typeof settings['echoCancellation'] is 'boolean'
-PASS settings['echoCancellation'] is true
+PASS settings['echoCancellation'] is false
** Constraint: {"facingMode":"environment","frameRate":30,"volume":1} - constraint not supported by an audio track should be ignored.
PASS settings['volume'] is 1
PASS typeof settings['echoCancellation'] is 'boolean'
-PASS settings['echoCancellation'] is true
+PASS settings['echoCancellation'] is false
PASS successfullyParsed is true
Modified: trunk/LayoutTests/fast/mediastream/apply-constraints-audio.html (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/apply-constraints-audio.html 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/apply-constraints-audio.html 2019-11-20 04:10:24 UTC (rev 252681)
@@ -9,29 +9,29 @@
{
message: "set volume to a valid value.",
constraint: { volume: .5 },
- expected: { volume: .5, echoCancellation: false },
+ expected: { volume: .5, echoCancellation: true },
},
{
message: "the 'exact' constraint it too big, promise should reject and no settings should change.",
constraint: { volume: { exact: 2.1 } },
- expected: { volume: .5, echoCancellation: false },
+ expected: { volume: .5, echoCancellation: true },
error: "volume",
},
{
message: "the 'exact' constraint it too small, promise should reject and no settings should change.",
constraint: { volume: { exact: -1 } },
- expected: { volume: .5, echoCancellation: false },
+ expected: { volume: .5, echoCancellation: true },
error: "volume",
},
{
message: "set echoCancellation to a valid value.",
- constraint: { echoCancellation: true },
- expected: { volume: .5, echoCancellation: true },
+ constraint: { echoCancellation: false },
+ expected: { volume: .5, echoCancellation: false },
},
{
message: "constraint not supported by an audio track should be ignored.",
constraint: { facingMode: "environment", frameRate: 30, volume: 1.0 },
- expected: { volume: 1.0, echoCancellation: true },
+ expected: { volume: 1.0, echoCancellation: false },
},
];
Modified: trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio-expected.txt (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio-expected.txt 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio-expected.txt 2019-11-20 04:10:24 UTC (rev 252681)
@@ -2,4 +2,5 @@
PASS Plugging in getUserMedia audio stream into Web Audio
PASS Web Audio should work even if number of channels of a track increases from 1 to 2
PASS Web Audio should work with mock audio destination
+PASS Check echo cancellation can be disabled in getUserMedia call
Modified: trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio.html (252680 => 252681)
--- trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio.html 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/fast/mediastream/getUserMedia-webaudio.html 2019-11-20 04:10:24 UTC (rev 252681)
@@ -5,6 +5,7 @@
<title>Testing getUserMedia plugged in Web Audio</title>
<script src=""
<script src=""
+ <script src=""
</head>
<body>
<script>
@@ -85,6 +86,39 @@
analyzer.disconnect(audioContext.destination);
}, "Web Audio should work with mock audio destination");
+var context;
+async function checkForNoise(stream, counter)
+{
+ if (!counter)
+ counter = 1;
+ else if (++counter > 4)
+ return Promise.resolve(false);
+ results = await analyseAudio(stream, 100, context);
+ if (results.heardNoise)
+ return Promise.resolve(true);
+ var results = await checkForNoise(stream, counter);
+ return results;
+}
+
+promise_test(async (test) => {
+ context = new webkitAudioContext();
+ if (window.testRunner)
+ testRunner.setUserMediaPermission(true);
+
+ let stream = await navigator.mediaDevices.getUserMedia({audio: { echoCancellation : true}});
+ assert_true(stream.getAudioTracks()[0].getSettings().echoCancellation);
+ const results = await analyseAudio(stream, 100, context);
+ assert_false(results.heardNoise, "should not hear noise");
+
+ stream = await navigator.mediaDevices.getUserMedia({audio: { echoCancellation : false}});
+ assert_false(stream.getAudioTracks()[0].getSettings().echoCancellation, "settings is ok");
+ const heardNoise = await checkForNoise(stream);
+ assert_true(heardNoise, "heard noise");
+
+ context.close();
+ context = null;
+}, "Check echo cancellation can be disabled in getUserMedia call");
+
</script>
</body>
</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (252680 => 252681)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-11-20 04:10:24 UTC (rev 252681)
@@ -1,3 +1,12 @@
+2019-11-19 Youenn Fablet <you...@apple.com>
+
+ getUserMedia echoCancellation constraint has no affect
+ https://bugs.webkit.org/show_bug.cgi?id=179411
+
+ Reviewed by Eric Carlson.
+
+ * web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt:
+
2019-11-19 Sihui Liu <sihui_...@apple.com>
Update expectations for bufferedAmount-unchanged-by-sync-xhr.any.worker.html
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt (252680 => 252681)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/mediacapture-streams/MediaDevices-getSupportedConstraints.https-expected.txt 2019-11-20 04:10:24 UTC (rev 252681)
@@ -12,7 +12,7 @@
FAIL resizeMode is supported assert_true: expected true got undefined
FAIL sampleRate is supported assert_true: expected true got false
FAIL sampleSize is supported assert_true: expected true got false
-FAIL echoCancellation is supported assert_true: expected true got false
+PASS echoCancellation is supported
FAIL autoGainControl is supported assert_true: expected true got undefined
FAIL noiseSuppression is supported assert_true: expected true got undefined
FAIL latency is supported assert_true: expected true got undefined
Modified: trunk/LayoutTests/webrtc/routines.js (252680 => 252681)
--- trunk/LayoutTests/webrtc/routines.js 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/LayoutTests/webrtc/routines.js 2019-11-20 04:10:24 UTC (rev 252681)
@@ -86,7 +86,7 @@
var analyser = context.createAnalyser();
var gain = context.createGain();
- var results = { heardHum: false, heardBip: false, heardBop: false };
+ var results = { heardHum: false, heardBip: false, heardBop: false, heardNoise: false };
analyser.fftSize = 2048;
analyser.smoothingTimeConstant = 0;
@@ -116,7 +116,10 @@
if (!results.heardBop)
results.heardBop = hasFrequency(500);
- if (results.heardHum && results.heardBip && results.heardBop)
+ if (!results.heardNoise)
+ results.heardNoise = hasFrequency(3000);
+
+ if (results.heardHum && results.heardBip && results.heardBop && results.heardNoise)
done();
};
Modified: trunk/Source/WebCore/ChangeLog (252680 => 252681)
--- trunk/Source/WebCore/ChangeLog 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/ChangeLog 2019-11-20 04:10:24 UTC (rev 252681)
@@ -1,3 +1,32 @@
+2019-11-19 Youenn Fablet <you...@apple.com>
+
+ getUserMedia echoCancellation constraint has no affect
+ https://bugs.webkit.org/show_bug.cgi?id=179411
+
+ Reviewed by Eric Carlson.
+
+ Update implementation to properly report echoCancellation is supported and can take true or false.
+ Update CoreAudioCaptureSource to initialize its state in constructor from the audio unit.
+ This allows getUserMedia constraints to kick in after construction and update the source parameters.
+ Audio unit parameters will then be set when the source will be asked to produce data.
+
+ To enable testing, the mock audio is now adding a high frequency hum when echo cancellation is off.
+
+ Covered by updated test.
+
+ * Modules/mediastream/MediaStreamTrack.cpp:
+ (WebCore::capabilityStringVector):
+ (WebCore::capabilityBooleanVector):
+ * platform/mediastream/RealtimeMediaSourceCenter.cpp:
+ (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
+ * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
+ * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
+ (WebCore::CoreAudioCaptureSource::initializeToStartProducingData):
+ * platform/mediastream/mac/MockAudioSharedUnit.mm:
+ (WebCore::MockAudioSharedUnit::reconfigure):
+ * platform/mock/MockRealtimeAudioSource.cpp:
+ (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
+
2019-11-19 Peng Liu <peng.l...@apple.com>
Assertion failure in HTMLMediaElement::enterFullscreen()
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp (252680 => 252681)
--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp 2019-11-20 04:10:24 UTC (rev 252681)
@@ -319,7 +319,7 @@
static Vector<String> capabilityStringVector(const Vector<RealtimeMediaSourceSettings::VideoFacingMode>& modes)
{
Vector<String> result;
- result.reserveCapacity(modes.size());
+ result.reserveInitialCapacity(modes.size());
for (auto& mode : modes)
result.uncheckedAppend(RealtimeMediaSourceSettings::facingMode(mode));
return result;
@@ -328,9 +328,10 @@
static Vector<bool> capabilityBooleanVector(RealtimeMediaSourceCapabilities::EchoCancellation cancellation)
{
Vector<bool> result;
- result.reserveCapacity(2);
+ result.reserveInitialCapacity(2);
result.uncheckedAppend(true);
- result.uncheckedAppend(cancellation == RealtimeMediaSourceCapabilities::EchoCancellation::ReadWrite);
+ if (cancellation == RealtimeMediaSourceCapabilities::EchoCancellation::ReadWrite)
+ result.uncheckedAppend(false);
return result;
}
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp (252680 => 252681)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.cpp 2019-11-20 04:10:24 UTC (rev 252681)
@@ -52,6 +52,7 @@
RealtimeMediaSourceCenter::RealtimeMediaSourceCenter()
{
+ m_supportedConstraints.setSupportsEchoCancellation(true);
m_supportedConstraints.setSupportsWidth(true);
m_supportedConstraints.setSupportsHeight(true);
m_supportedConstraints.setSupportsAspectRatio(true);
Modified: trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp (252680 => 252681)
--- trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp 2019-11-20 04:10:24 UTC (rev 252681)
@@ -39,6 +39,7 @@
static const double s_HumFrequency = 150;
static const double s_HumVolume = 0.1;
+// FIXME: Add noise of frequency 3000 in case echoCancellation is false.
class WrappedMockRealtimeAudioSource : public MockRealtimeAudioSource {
public:
static Ref<WrappedMockRealtimeAudioSource> create(String&& deviceID, String&& name, String&& hashSalt)
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp (252680 => 252681)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp 2019-11-20 04:10:24 UTC (rev 252681)
@@ -730,10 +730,14 @@
auto& unit = this->unit();
unit.setCaptureDevice(String { persistentID() }, m_captureDeviceID);
- initializeEchoCancellation(unit.enableEchoCancellation());
- initializeSampleRate(unit.sampleRate());
- initializeVolume(unit.volume());
+ bool shouldReconfigure = echoCancellation() != unit.enableEchoCancellation() || sampleRate() != unit.sampleRate() || volume() != unit.volume();
+ unit.setEnableEchoCancellation(echoCancellation());
+ unit.setSampleRate(sampleRate());
+ unit.setVolume(volume());
+ if (shouldReconfigure)
+ scheduleReconfiguration();
+
unit.addClient(*this);
}
Modified: trunk/Source/WebCore/platform/mediastream/mac/MockAudioSharedUnit.mm (252680 => 252681)
--- trunk/Source/WebCore/platform/mediastream/mac/MockAudioSharedUnit.mm 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/platform/mediastream/mac/MockAudioSharedUnit.mm 2019-11-20 04:10:24 UTC (rev 252681)
@@ -65,6 +65,8 @@
static const double BopFrequency = 500;
static const double HumFrequency = 150;
static const double HumVolume = 0.1;
+static const double NoiseFrequency = 3000;
+static const double NoiseVolume = 0.05;
template <typename AudioSampleType>
static void writeHum(float amplitude, float frequency, float sampleRate, AudioSampleType *p, uint64_t count)
@@ -230,6 +232,8 @@
addHum(BipBopVolume, BipFrequency, rate, 0, m_bipBopBuffer.data() + bipStart, bipBopSampleCount);
addHum(BipBopVolume, BopFrequency, rate, 0, m_bipBopBuffer.data() + bopStart, bipBopSampleCount);
+ if (!enableEchoCancellation())
+ addHum(NoiseVolume, NoiseFrequency, rate, 0, m_bipBopBuffer.data(), sampleCount);
}
void MockAudioSharedUnit::emitSampleBuffers(uint32_t frameCount)
Modified: trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp (252680 => 252681)
--- trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp 2019-11-20 03:41:57 UTC (rev 252680)
+++ trunk/Source/WebCore/platform/mock/MockRealtimeAudioSource.cpp 2019-11-20 04:10:24 UTC (rev 252681)
@@ -72,6 +72,7 @@
m_device = *device;
setSampleRate(WTF::get<MockMicrophoneProperties>(m_device.properties).defaultSampleRate);
+ initializeEchoCancellation(true);
}
MockRealtimeAudioSource::~MockRealtimeAudioSource()