Bug 1306594 - Wait for the Analyser to start gathering data before analysing. r=padenot draft
authorAndreas Pehrson <pehrsons@gmail.com>
Thu, 29 Sep 2016 10:40:35 +0200
changeset 420380 eb33b800c0d1d47f92841f7489789a296b599de6
parent 420379 c8a660c5f105e60ad536ddde0c3edd637ab5b7c1
child 532797 94d8ac54469b041810447dd8cd26f900e3aef6ae
push id31181
push userdrno@ohlmeier.org
push dateTue, 04 Oct 2016 04:58:14 +0000
reviewerspadenot
bugs1306594
milestone52.0a1
Bug 1306594 - Wait for the Analyser to start gathering data before analysing. r=padenot This is a real problem in for instance test_peerConnection_verifyAudioAfterRenegotiation.html where we check that disabled tracks don't output any audio. Locally the analyser calls the checking function 3 times before it has gathered any output samples at all, meaning that the disabled-track-checks always pass. MozReview-Commit-ID: 3SKGsMZ1xoL
dom/media/tests/mochitest/head.js
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -131,17 +131,18 @@ AudioStreamAnalyser.prototype = {
         var success = analysisFunction(self.getByteFrequencyData());
         if (success) {
           resolve();
           return;
         }
         // else, we need more time
         requestAnimationFrame(analysisLoop);
       }
-      analysisLoop();
+      // We need to give the Analyser some time to start gathering data.
+      wait(200).then(analysisLoop);
     });
   },
 
   /**
    * Return the FFT bin index for a given frequency.
    *
    * @param {double} frequency
    *        The frequency for whicht to return the bin number.