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 419424 619063b62c64cb37544c53edd6e877a9c22fc4d3
parent 418456 b1d60f2f68c7cccc96fcf9a2075bb430a500a0f2
child 532584 5effa338dd607c30e7381bda9b3668e177df4c8c
push id30941
push userbmo:pehrson@telenordigital.com
push dateFri, 30 Sep 2016 12:32:59 +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.