mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 09:01:16 +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();
|
||||
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");
|
||||
|
Loading…
Reference in New Issue
Block a user