Bug 1051658 - Part 3: Release decoders more aggressively for it is easy to exceed the limit of active cubeb streams on OSX 10.6 and cause decode errors and test failures. r=kinetik

This commit is contained in:
JW Wang 2014-10-01 18:36:00 -04:00
parent 3c28bac602
commit 17f25a9167
3 changed files with 16 additions and 8 deletions

View File

@ -819,11 +819,13 @@ function MediaTestManager() {
if (this.onFinished) {
this.onFinished();
}
mediaTestCleanup();
var end = new Date();
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
SimpleTest.info("Running time: " + (end.getTime() - this.startTime.getTime())/1000 + "s");
SimpleTest.finish();
var onCleanup = function() {
var end = new Date();
SimpleTest.info("Finished at " + end + " (" + (end.getTime() / 1000) + "s)");
SimpleTest.info("Running time: " + (end.getTime() - this.startTime.getTime())/1000 + "s");
SimpleTest.finish();
}.bind(this);
mediaTestCleanup(onCleanup);
return;
}
}
@ -832,7 +834,7 @@ function MediaTestManager() {
// Ensures we've got no active video or audio elements in the document, and
// forces a GC to release the address space reserved by the decoders' threads'
// stacks.
function mediaTestCleanup() {
function mediaTestCleanup(callback) {
var V = document.getElementsByTagName("video");
for (i=0; i<V.length; i++) {
removeNodeAndSource(V[i]);
@ -843,7 +845,12 @@ function mediaTestCleanup() {
removeNodeAndSource(A[i]);
A[i] = null;
}
SpecialPowers.forceGC();
var cb = function() {
if (callback) {
callback();
}
}
SpecialPowers.exactGC(window, cb);
}
(function() {

View File

@ -39,6 +39,7 @@ function stopped(event) {
return;
v._finished = true;
ok(v.paused, "Video should be paused after removing from the Document");
removeNodeAndSource(v);
manager.finished(v.token);
}

View File

@ -42,7 +42,7 @@ function seekEnded(e) {
v.currentTime + " for " + v._name);
ok(!v.ended, "Checking ended is false for " + v._name);
v._finished = true;
v.parentNode.removeChild(v);
removeNodeAndSource(v);
manager.finished(v.token);
}