Closed Bug 1070110 Opened 5 years ago Closed 4 years ago

Intermittent test_mediarecorder_record_timeslice.html | onstop unexpectedly fired before ondataavailable

Categories

(Core :: Audio/Video: Recording, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox40 --- wontfix
firefox41 --- fixed
firefox42 --- fixed
firefox-esr38 --- unaffected
b2g-v2.2 --- fixed
b2g-v2.2r --- fixed
b2g-master --- fixed

People

(Reporter: RyanVM, Assigned: bechen)

Details

(Keywords: intermittent-failure)

Attachments

(1 file, 1 obsolete file)

https://tbpl.mozilla.org/php/getParsedLog.php?id=48479582&tree=B2g-Inbound

b2g_emulator_vm b2g-inbound opt test mochitest-3 on 2014-09-19 09:43:14 PDT for push ba8ec9df24fe
slave: tst-linux64-spot-954

10:18:14     INFO -  315 INFO TEST-START | /tests/content/media/test/test_mediarecorder_record_timeslice.html
10:18:21     INFO -  dumping last 13 message(s)
10:18:21     INFO -  if you need more context, please use SimpleTest.requestCompleteLog() in your test
10:18:21     INFO -  316 INFO Started Fri Sep 19 2014 17:18:16 GMT+0000 (UTC) (1411147096.565s)
10:18:21     INFO -  317 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | [started detodos.opus-0] Length of array should match number of running tests
10:18:21     INFO -  318 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Media recorder should be recording
10:18:21     INFO -  319 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Media recorder stream = element stream at the start of recording
10:18:21     INFO -  320 INFO ondataavailable fired
10:18:21     INFO -  321 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Events fired from ondataavailable should be BlobEvent
10:18:21     INFO -  322 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Event type should dataavailable
10:18:21     INFO -  323 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Blob data size received is greater than or equal to zero
10:18:21     INFO -  324 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Blob data received should have type = audio/ogg
10:18:21     INFO -  325 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Mime type in ondataavailable = audio/ogg
10:18:21     INFO -  326 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Media recorder is inactive after being stopped
10:18:21     INFO -  327 INFO TEST-PASS | /tests/content/media/test/test_mediarecorder_record_timeslice.html | Media recorder stream = element stream post recording
10:18:21     INFO -  328 INFO onstop fired
10:18:21     INFO -  329 INFO TEST-UNEXPECTED-FAIL | /tests/content/media/test/test_mediarecorder_record_timeslice.html | onstop unexpectedly fired before ondataavailable - expected PASS
10:18:22     INFO -  330 INFO TEST-OK | /tests/content/media/test/test_mediarecorder_record_timeslice.html | took 7757ms
Hi Benjamin,
The events seem to get disordered. Not sure it is related to the problem you're looking at.
Assignee: nobody → bechen
Ifigure out the root case.

In testcase:
element.oncanplaythrough = function() {
  mediaRecorder.start(250);
};

When we start recording, the stream is almost reach the end. So before the 250ms duration, the END event comes to MediaRecorder trigger one ondataavailable and onstop event. Hence there is only one ondataavailable.
oncanplaythrough is never reliable on slow machines. Listen to onmetadataloaded instead.
(In reply to JW Wang [:jwwang] from comment #12)
> oncanplaythrough is never reliable on slow machines. Listen to
> onmetadataloaded instead.

In this case, even we listen the onmetadataloaded event, we still can't guarantee there are 2 ondataavailable before the onstop event. I need to modify the testcase, maybe relax the number of ondataavailable checking or ensure the content have duration longer than 250ms. (But using the timer always have timing issue...)
Why no at least 2 ondataavailable events?
(In reply to JW Wang [:jwwang] from comment #14)
> Why no at least 2 ondataavailable events?

mediaRecorder.start(250); means the MR will push blob every 250ms. So, if the total duration is smaller than 250ms or the remain duration after the MR start is smaller than 250ms, there will be only 1 ondataavailable then onstop.
It sounds not reliable to me. Even if the file duration is more than 1s, it is still possible to push only one blob on very slow B2G machines for timer is inaccurate.
Attached patch bug-1070110.v01.patch (obsolete) — Splinter Review
In testcase, enable the loop attribute so that we can ensure the testcase will receive at least 2 dataavailable.
Attachment #8644167 - Flags: review?(jwwang)
Comment on attachment 8644167 [details] [diff] [review]
bug-1070110.v01.patch

Review of attachment 8644167 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/test/test_mediarecorder_record_timeslice.html
@@ +24,5 @@
>  
>    element.src = test.name;
>    element.test = test;
>    element.stream = element.mozCaptureStream();
> +  element.loop = true;

Pause the element when done with the test to keep us in a good shape.

@@ +78,5 @@
>           'Media recorder is inactive after being stopped');
>        is(mediaRecorder.stream, element.stream,
>           'Media recorder stream = element stream post recording');
>  
> +    } else if (dataAvailableCount >= 2) {

I don't think you need to change it since onDataAvailableFirst will be set to true when dataAvailableCount reaches 2. You don't need to set it again when dataAvailableCount goes from 2 to 3.

@@ +85,5 @@
>      }
>    };
>  
>    // Start recording once canplaythrough fires
>    element.oncanplaythrough = function() {

Listen to metadataloaded event so we can start recording as soon as possible because you might never have canplaythrough on very slow machines.
Attachment #8644167 - Flags: review?(jwwang) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/25a43f6817f4
Status: NEW → RESOLVED
Closed: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.