Closed Bug 1197669 Opened 9 years ago Closed 9 years ago

Enable test_mediarecorder_record_gum_video_timeslice.html on B2G platform.

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: bechen, Assigned: bechen)

References

Details

Attachments

(3 files, 4 obsolete files)

      No description provided.
Now I'm fixing the testcase for b2g, during the fix, I found a timeout issue that the the js is waiting for the onstop event. It might be the same failure at bug 1149842 comment 42.
After discussed with John, we have confirmed that there is a bug in OMXTrackEncoderccpp. The EOS signal may not send into MediaCodec because the dequeue/enqueue buffer may be timeout. I'll fix it too.
Blocks: 1149842
Blocks: 1198157
Attached patch bug-1197669-part1.v01.patch (obsolete) — Splinter Review
1. enable the testcase on b2g/android platform.
2. check the mimetype if the blob is not empty.
Attachment #8652745 - Flags: review?(jwwang)
Attached patch bug-1197669-part2.v01.patch (obsolete) — Splinter Review
1. Ensure the EOS is sent to MediaCodec. Change the |OMXAudioEncoder::Encode| and |OMXVideoEncoder::Encode|
2. mEndOfStream should be protected by monitor.
Attachment #8652748 - Flags: feedback?(jolin)
Attached patch bug-1197669-part3.v01.patch (obsolete) — Splinter Review
In MediaRecorder, ensure the start event comes before any blobs.
Attachment #8652749 - Flags: review?(jwwang)
Comment on attachment 8652745 [details] [diff] [review]
bug-1197669-part1.v01.patch

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

::: dom/media/test/test_mediarecorder_record_gum_video_timeslice.html
@@ +41,5 @@
>           'Event type should dataavailable');
>        ok(evt.data.size >= 0,
> +         'Blob data size ' + evt.data.size + ' received is greater than or equal to zero');
> +      if (evt.data.size > 0) {
> +        is(mediaRecorder.mimeType, evt.data.type,

Why do we check mediaRecorder.mimeType only when evt.data.size > 0?
Comment on attachment 8652749 [details] [diff] [review]
bug-1197669-part3.v01.patch

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

::: dom/media/MediaRecorder.cpp
@@ +498,3 @@
>            NS_DispatchToMainThread(
>              new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
> +          mIsStartEventFired = true;

It is a data race for mIsStartEventFired is accessed on multiple threads.
Attachment #8652749 - Flags: review?(jwwang) → review-
(In reply to JW Wang [:jwwang] from comment #7)
> Comment on attachment 8652749 [details] [diff] [review]
> bug-1197669-part3.v01.patch
> 
> Review of attachment 8652749 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/media/MediaRecorder.cpp
> @@ +498,3 @@
> >            NS_DispatchToMainThread(
> >              new DispatchStartEventRunnable(this, NS_LITERAL_STRING("start")));
> > +          mIsStartEventFired = true;
> 
> It is a data race for mIsStartEventFired is accessed on multiple threads.

It won't have data race, because |DoSessionEndTask| on mian thread and |Session::Extract| on encoder thread wont exist at the same time. |DoSessionEndTask| only be called when something wrong so there is no |ExtractRunnable| running.
(In reply to JW Wang [:jwwang] from comment #6)
> Comment on attachment 8652745 [details] [diff] [review]
> bug-1197669-part1.v01.patch
> 
> Review of attachment 8652745 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: dom/media/test/test_mediarecorder_record_gum_video_timeslice.html
> @@ +41,5 @@
> >           'Event type should dataavailable');
> >        ok(evt.data.size >= 0,
> > +         'Blob data size ' + evt.data.size + ' received is greater than or equal to zero');
> > +      if (evt.data.size > 0) {
> > +        is(mediaRecorder.mimeType, evt.data.type,
> 
> Why do we check mediaRecorder.mimeType only when evt.data.size > 0?

Good question, since we ensure the start event comes before blob, we can also ensure the mediaRecorder.mimeType won't be empty because the mediaRecorder.mimeType was set in |DispatchStartEventRunnable|. So we should able to check mediaRecorder.mimeType even the blob size is 0.
(In reply to Benjamin Chen [:bechen] from comment #8)
> It won't have data race, because |DoSessionEndTask| on mian thread and
> |Session::Extract| on encoder thread wont exist at the same time.
> |DoSessionEndTask| only be called when something wrong so there is no
> |ExtractRunnable| running.

Data races are also about memory visibility which is how a change in a memory location in a thread becomes visible to another thread.
Attachment #8652745 - Flags: review?(jwwang) → review+
Attachment #8652748 - Flags: feedback?(jolin) → feedback+
Check the blob's mimetype even it is an empty blob.
Attachment #8652745 - Attachment is obsolete: true
Attachment #8653316 - Flags: review+
Attached patch bug-1197669-part2.v01.patch (obsolete) — Splinter Review
Add comments.
Attachment #8652748 - Attachment is obsolete: true
Attachment #8653317 - Flags: review?(jwwang)
Address comment 7, 8, 10.

See comment 8, since the |DoSessionEndTask| and |ExtractRunnable| are exclusive, so I can remove |mIsStartEventFired| checking on main thread.
Attachment #8652749 - Attachment is obsolete: true
Attachment #8653319 - Flags: review?(jwwang)
Comment on attachment 8653317 [details] [diff] [review]
bug-1197669-part2.v01.patch

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

Not familiar with omx code. Maybe Sotaro should review it.
Attachment #8653317 - Flags: review?(jwwang) → review?(sotaro.ikeda.g)
Attachment #8653319 - Flags: review?(jwwang) → review+
Comment on attachment 8653317 [details] [diff] [review]
bug-1197669-part2.v01.patch

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

Review+ as a short term fix. For a long term, it seems better to fix TrackEncoder's implementation and MediaCodec handling. About MediaCodec handling, it might be better to use kWhatEncoderActivity message to get free input buffer like MediaCodecSource.

FYI: MediaCodecSource diagram.
  https://github.com/sotaroikeda/android-diagrams/blob/master/media/MediaCodecSource_5.1.pdf
Attachment #8653317 - Flags: review?(sotaro.ikeda.g) → review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: