Bug 910903 - Stop requesting data when count >= 30 to prevent the main thread from starving the encoding thread. r=jsmith

This commit is contained in:
JW Wang 2014-01-28 13:41:11 +08:00
parent 2c0f5b61a5
commit 4a45687cda

View File

@ -17,14 +17,17 @@ function startTest() {
mediaRecorder.start();
info("mediaRecorder start");
mediaRecorder.ondataavailable = function (e) {
if (count++ == 30) {
++count;
info("got ondataavailable data size = " + e.data.size);
// no more requestData() to prevent busy main thread from starving
// the encoding thread
if (count == 30) {
info("stream.stop");
stream.stop();
}
if (mediaRecorder.state == 'recording') {
info("get data again");
} else if (count < 30 && mediaRecorder.state == 'recording') {
info("requestData again");
mediaRecorder.requestData();
}
info("got ondataavailable data size = " + e.data.size);
}
mediaRecorder.requestData();
info("mediaRecorder requestData");