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
--- 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.