Title: [272296] trunk/LayoutTests
Revision
272296
Author
[email protected]
Date
2021-02-02 21:10:46 -0800 (Tue, 02 Feb 2021)

Log Message

http/wpt/mediarecorder/mute-tracks.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=221195

Reviewed by Eric Carlson.

In case bot is slow, we were doing more than one analysis.
For each analysis, we were creating a new MediaElementSourceNode for the same video element which is not allowed.
Instead, do the AudioContext setup once and run the analysis steps as long as needed.

* http/wpt/mediarecorder/mute-tracks-expected.txt:
* http/wpt/mediarecorder/mute-tracks.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (272295 => 272296)


--- trunk/LayoutTests/ChangeLog	2021-02-03 05:10:24 UTC (rev 272295)
+++ trunk/LayoutTests/ChangeLog	2021-02-03 05:10:46 UTC (rev 272296)
@@ -1,3 +1,17 @@
+2021-02-02  Youenn Fablet  <[email protected]>
+
+        http/wpt/mediarecorder/mute-tracks.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=221195
+
+        Reviewed by Eric Carlson.
+
+        In case bot is slow, we were doing more than one analysis.
+        For each analysis, we were creating a new MediaElementSourceNode for the same video element which is not allowed.
+        Instead, do the AudioContext setup once and run the analysis steps as long as needed.
+
+        * http/wpt/mediarecorder/mute-tracks-expected.txt:
+        * http/wpt/mediarecorder/mute-tracks.html:
+
 2021-02-02  Amir Mark Jr  <[email protected]>
 
         [BigSur WK1] imported/w3c/web-platform-tests/media-source/mediasource-config-change-webm-v* is consistently failing

Modified: trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks-expected.txt (272295 => 272296)


--- trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks-expected.txt	2021-02-03 05:10:24 UTC (rev 272295)
+++ trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks-expected.txt	2021-02-03 05:10:46 UTC (rev 272296)
@@ -1,6 +1,6 @@
 
 
-PASS Recording a muted audio track should prodcue silence
+PASS Recording a muted audio track should produce silence
 PASS Muting an audio track should record silence
 PASS Muting a video track should produce black frames
 

Modified: trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html (272295 => 272296)


--- trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2021-02-03 05:10:24 UTC (rev 272295)
+++ trunk/LayoutTests/http/wpt/mediarecorder/mute-tracks.html	2021-02-03 05:10:46 UTC (rev 272296)
@@ -13,26 +13,31 @@
     <video id="video3" controls></video>
     <canvas id="canvas3" width="320" height="240"></canvas>
     <script>
-function analyseAudio(streamOrVideo, duration, context)
+function setupAudioContext(context, streamOrVideo)
 {
-    return new Promise((resolve, reject) => {
-        var sourceNode = streamOrVideo instanceof MediaStream ? context.createMediaStreamSource(streamOrVideo) : context.createMediaElementSource(streamOrVideo);
+    var sourceNode = streamOrVideo instanceof MediaStream ? context.createMediaStreamSource(streamOrVideo) : context.createMediaElementSource(streamOrVideo);
 
-        var analyser = context.createAnalyser();
-        var gain = context.createGain();
+    var analyser = context.createAnalyser();
+    var gain = context.createGain();
 
-        var results = { heardHum: false, heardBip: false, heardBop: false, heardNoise: false };
+    analyser.fftSize = 2048;
+    analyser.smoothingTimeConstant = 0;
+    analyser.minDecibels = -100;
+    analyser.maxDecibels = 0;
+    gain.gain.value = 0;
 
-        analyser.fftSize = 2048;
-        analyser.smoothingTimeConstant = 0;
-        analyser.minDecibels = -100;
-        analyser.maxDecibels = 0;
-        gain.gain.value = 0;
+    sourceNode.connect(analyser);
+    analyser.connect(gain);
+    gain.connect(context.destination);
 
-        sourceNode.connect(analyser);
-        analyser.connect(gain);
-        gain.connect(context.destination);
+    return analyser;
+}
 
+function analyseAudio(analyser, duration, context)
+{
+    return new Promise((resolve, reject) => {
+       var results = { heardHum: false, heardBip: false, heardBop: false, heardNoise: false };
+
        function analyse() {
            var freqDomain = new Uint8Array(analyser.frequencyBinCount);
            analyser.getByteFrequencyData(freqDomain);
@@ -78,11 +83,14 @@
 
 async function doHumAnalysis(streamOrVideo, expected)
 {
-    var context = new AudioContext();
+    let context = new AudioContext();
+    let analyser = setupAudioContext(context, streamOrVideo);
     for (var cptr = 0; cptr < 20; cptr++) {
-        var results = await analyseAudio(streamOrVideo, 200, context);
-        if (results.heardHum === expected)
+        const results = await analyseAudio(analyser, 200, context);
+        if (results.heardHum === expected) {
+            await context.close();
             return true;
+        }
         await waitFor(50);
     }
     await context.close();
@@ -153,7 +161,7 @@
     assert_true(results, "Should not hear hum");
 
     URL.revokeObjectURL(url);
-}, "Recording a muted audio track should prodcue silence");
+}, "Recording a muted audio track should produce silence");
 
 promise_test(async (test) => {
     const stream = await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to