зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1208371 - Modify WebAudio source nodes tests to wait for tracks befoure measuring nr of samples. r=padenot
Otherwise we don't get an accurate nr-of-nonzero-samples measurement as the sources now lock on to a track (main thread) before attaching a listener. MozReview-Commit-ID: Jhsr6kgkdcM --HG-- extra : rebase_source : d94804a601936f456b6bf1b5abc927e9a0bd0329
This commit is contained in:
Родитель
b7f805ee20
Коммит
fc68de1ab0
|
@ -14,9 +14,6 @@ SimpleTest.waitForExplicitFinish();
|
|||
function test() {
|
||||
var audio = new Audio("small-shot.ogg");
|
||||
var context = new AudioContext();
|
||||
var node = context.createMediaElementSource(audio);
|
||||
var sp = context.createScriptProcessor(2048, 1);
|
||||
node.connect(sp);
|
||||
var expectedMinNonzeroSampleCount;
|
||||
var expectedMaxNonzeroSampleCount;
|
||||
var nonzeroSampleCount = 0;
|
||||
|
@ -58,7 +55,10 @@ function test() {
|
|||
}
|
||||
}
|
||||
|
||||
audio.oncanplaythrough = function() {
|
||||
audio.onloadedmetadata = function() {
|
||||
var node = context.createMediaElementSource(audio);
|
||||
var sp = context.createScriptProcessor(2048, 1);
|
||||
node.connect(sp);
|
||||
// Use a fuzz factor of 100 to account for samples that just happen to be zero
|
||||
expectedMinNonzeroSampleCount = Math.floor(audio.duration*context.sampleRate) - 100;
|
||||
expectedMaxNonzeroSampleCount = Math.floor(audio.duration*context.sampleRate) + 500;
|
||||
|
|
|
@ -14,9 +14,6 @@ SimpleTest.waitForExplicitFinish();
|
|||
function test() {
|
||||
var audio = new Audio("small-shot.ogg");
|
||||
var context = new AudioContext();
|
||||
var node = context.createMediaStreamSource(audio.mozCaptureStreamUntilEnded());
|
||||
var sp = context.createScriptProcessor(2048, 1, 0);
|
||||
node.connect(sp);
|
||||
var expectedMinNonzeroSampleCount;
|
||||
var expectedMaxNonzeroSampleCount;
|
||||
var nonzeroSampleCount = 0;
|
||||
|
@ -58,7 +55,10 @@ function test() {
|
|||
}
|
||||
}
|
||||
|
||||
audio.oncanplaythrough = function() {
|
||||
audio.onloadedmetadata = function() {
|
||||
var node = context.createMediaStreamSource(audio.mozCaptureStreamUntilEnded());
|
||||
var sp = context.createScriptProcessor(2048, 1, 0);
|
||||
node.connect(sp);
|
||||
// Use a fuzz factor of 100 to account for samples that just happen to be zero
|
||||
expectedMinNonzeroSampleCount = Math.floor(audio.duration*context.sampleRate) - 100;
|
||||
expectedMaxNonzeroSampleCount = Math.floor(audio.duration*context.sampleRate) + 500;
|
||||
|
|
Загрузка…
Ссылка в новой задаче