mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
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:
parent
2c0f5b61a5
commit
4a45687cda
@ -17,14 +17,17 @@ function startTest() {
|
|||||||
mediaRecorder.start();
|
mediaRecorder.start();
|
||||||
info("mediaRecorder start");
|
info("mediaRecorder start");
|
||||||
mediaRecorder.ondataavailable = function (e) {
|
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();
|
stream.stop();
|
||||||
}
|
} else if (count < 30 && mediaRecorder.state == 'recording') {
|
||||||
if (mediaRecorder.state == 'recording') {
|
info("requestData again");
|
||||||
info("get data again");
|
|
||||||
mediaRecorder.requestData();
|
mediaRecorder.requestData();
|
||||||
}
|
}
|
||||||
info("got ondataavailable data size = " + e.data.size);
|
|
||||||
}
|
}
|
||||||
mediaRecorder.requestData();
|
mediaRecorder.requestData();
|
||||||
info("mediaRecorder requestData");
|
info("mediaRecorder requestData");
|
||||||
|
Loading…
Reference in New Issue
Block a user