Closed
Bug 1168531
Opened 11 years ago
Closed 11 years ago
Fix MediaCodecReader video playback problem
Categories
(Core :: Audio/Video, defect)
Core
Audio/Video
Tracking
()
RESOLVED
FIXED
mozilla41
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | fixed |
People
(Reporter: sotaro, Assigned: sotaro)
References
Details
Attachments
(5 files, 1 obsolete file)
|
740 bytes,
patch
|
Details | Diff | Splinter Review | |
|
8.70 KB,
patch
|
bwu
:
review+
|
Details | Diff | Splinter Review |
|
943 bytes,
patch
|
bwu
:
review+
|
Details | Diff | Splinter Review |
|
2.86 KB,
patch
|
sotaro
:
review+
|
Details | Diff | Splinter Review |
|
11.20 KB,
patch
|
Details | Diff | Splinter Review |
Bug 1154194 is going to add AskMediaCodecAndWait() usage to MediaCodecReader. It needs to be removed from MediaCodecReader. But just removing it causes playback regression. Bug 1132832 causes it. To fix it, MediaCodecProxy is also necessary to be updated.
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → sotaro.ikeda.g
| Assignee | ||
Comment 1•11 years ago
|
||
| Assignee | ||
Comment 2•11 years ago
|
||
| Assignee | ||
Updated•11 years ago
|
Summary: Remove AskMediaCodecAndWait() usage from MediaCodecReader → Remove AskMediaCodecAndWait() usage for Video decoder in MediaCodecReader
| Assignee | ||
Comment 3•11 years ago
|
||
I changed my mind. It is better to be done in Bug 1168456 .
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
| Assignee | ||
Updated•11 years ago
|
| Assignee | ||
Comment 4•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #3)
> I changed my mind. It is better to be done in Bug 1168456 .
I changed my mind again, MediaCodecReader has several problems related video playback.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
| Assignee | ||
Updated•11 years ago
|
Summary: Remove AskMediaCodecAndWait() usage for Video decoder in MediaCodecReader → Fix MediaCodecReader video playback problem
| Assignee | ||
Comment 5•11 years ago
|
||
| Assignee | ||
Comment 6•11 years ago
|
||
By applying all patches, video handling still has a problem. Codec resource free is not handled correctly.
| Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #6)
> By applying all patches, video handling still has a problem. Codec resource
> free is not handled correctly.
Same problem exists also on default master flame-kk's MediaCodecReader video playback.
| Assignee | ||
Updated•11 years ago
|
| Assignee | ||
Comment 8•11 years ago
|
||
When the problem happens, MediaCodecReader::EnsureCodecFormatParsed() falled into infinite loop because of endless INVALID_OPERATION error handling.
| Assignee | ||
Updated•11 years ago
|
Attachment #8610750 -
Flags: review?(bwu)
| Assignee | ||
Updated•11 years ago
|
Attachment #8610839 -
Flags: review?(bwu)
| Assignee | ||
Updated•11 years ago
|
Attachment #8610967 -
Flags: review?(bwu)
Comment 9•11 years ago
|
||
Comment on attachment 8610750 [details] [diff] [review]
patch part 1 - Revert MediaCodecProxy::AskMediaCodecAndWait() usage
Review of attachment 8610750 [details] [diff] [review]:
-----------------------------------------------------------------
May I know why it is required to revert AskMediaCodecAndWait?
This mechanism works well in Gonk PDM via MP4Reader and MediaFormatReader.
Except one problem I just found during checking the flow of asking codec resource. When video element tries to enter dormant, ReleaseMediaResource will not be handled due to AskMediaCodecAndWait. I have created the bug 1168813 for it.
| Assignee | ||
Comment 10•11 years ago
|
||
If MediaCodecReader could not get video codec, this function blocks forever. This could typically happen when multiple <video> elements exit on the system. This blocks task Queue thread forever.
CreateMediaCodecs() is called under MediaCodecReader::ReadMetadata(). Therefore, ReadMetadata() could be blocked forever if there are multiple multiple <video> elements exists. This should not happen. Bug 1132832 Comment 12 also have similar comment to AskMediaCodecAndWait().
After this bug is fixed, I am going to soon replace MediaCodecReader::ReadMetadata() by MediaCodecReader::AsyncReadMetadata(). AsyncReadMetadata() is async function, such possible long time block should not happen.
Comment 12•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #10)
> If MediaCodecReader could not get video codec, this function blocks forever.
> This could typically happen when multiple <video> elements exit on the
> system. This blocks task Queue thread forever.
Yeah. Would that blocked behavior cause any problems? Before getting codec resource, there should be no tasks waiting for being handled except the case in bug 1168813.
>
> CreateMediaCodecs() is called under MediaCodecReader::ReadMetadata().
> Therefore, ReadMetadata() could be blocked forever if there are multiple
> multiple <video> elements exists. This should not happen. Bug 1132832
> Comment 12 also have similar comment to AskMediaCodecAndWait().
Yes. IIUC, it is to implement async init() and then remove AskMediaCodecAndWait.
>
> After this bug is fixed, I am going to soon replace
> MediaCodecReader::ReadMetadata() by MediaCodecReader::AsyncReadMetadata().
> AsyncReadMetadata() is async function, such possible long time block should
> not happen.
Currently MediaFormatReader (replace MP4Reader) already supports AsyncReadMetadata and its decoding pipeline(gonk PDM, GonkMediaDataDecoder) uses AskMediaCodecAndWait as well. So far it works well. It still has the blocked situation as you mentioned.
Flags: needinfo?(bwu)
| Assignee | ||
Comment 13•11 years ago
|
||
(In reply to Blake Wu [:bwu][:blakewu] from comment #12)
> (In reply to Sotaro Ikeda [:sotaro] from comment #10)
> > If MediaCodecReader could not get video codec, this function blocks forever.
> > This could typically happen when multiple <video> elements exit on the
> > system. This blocks task Queue thread forever.
> Yeah. Would that blocked behavior cause any problems? Before getting codec
> resource, there should be no tasks waiting for being handled except the case
> in bug 1168813.
During blocking, TaskQueue thread can not run another task. Why do you think it is not a problematic? In this case, it could continue forever.
Flags: needinfo?(bwu)
| Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #13)
> > Yeah. Would that blocked behavior cause any problems? Before getting codec
> > resource, there should be no tasks waiting for being handled except the case
> > in bug 1168813.
If we handle it as async, even bug 1168813 do not happen. And if is works as async, we could add another task in future and do not need to care about the blocking problem.
Removing blocking and make async is one of the important current gecko media playback framework's intent, isn't is?
| Assignee | ||
Comment 15•11 years ago
|
||
I actually do not understand why AskMediaCodecAndWait() was started to be used for video codec instead of fixing the problem correctly.
Comment 16•11 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #15)
> I actually do not understand why AskMediaCodecAndWait() was started to be
> used for video codec instead of fixing the problem correctly.
AFAIK, originally ayang intended to remove/simplify those waiting and reserving coded resource codes from MediaDecoder and MDSM to readers. This codec reserving and waiting mechanism should be platform specific and would be better *not* to be exposed to the upper layer(MediaDecoder and MDSM).
Anyway, after finding the problem in bug 1168813 and the blocked behavior may cause the potential problem in the future as you mentioned, now I am clear and also agree with you that we should revert AskMediaCodecAndWait and use MediaPromise for the waiting resource which also simplifies the codes in MediaDecoder and MDSM. Awesome and thanks!
Flags: needinfo?(bwu)
Updated•11 years ago
|
Attachment #8610750 -
Flags: review?(bwu) → review+
Updated•11 years ago
|
Attachment #8610967 -
Flags: review?(bwu) → review+
Comment 17•11 years ago
|
||
Comment on attachment 8610839 [details] [diff] [review]
patch part 2 - Make video decoder allocation async
Review of attachment 8610839 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me....for video case.
How about audio part? I didn't find the part to create audio codec. Did I miss something?
::: dom/media/omx/MediaCodecProxy.cpp
@@ +142,5 @@
> +MediaCodecProxy::AsyncAskMediaCodec()
> +{
> + if ((strncasecmp(mCodecMime.get(), "video/", 6) != 0) ||
> + (mResourceHandler == nullptr)) {
> + return false;
Remove trailing space.
Comment 18•11 years ago
|
||
(In reply to Blake Wu [:bwu][:blakewu] from comment #17)
> Comment on attachment 8610839 [details] [diff] [review]
> patch part 2 - Make video decoder allocation async
>
> Review of attachment 8610839 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> Looks good to me....for video case.
> How about audio part? I didn't find the part to create audio codec. Did I
> miss something?
|AskMediaCodecAndWait()| for audio and the new function |AsyncAskMediaCodec()| for video.
Comment 19•11 years ago
|
||
(In reply to Benjamin Chen [:bechen] from comment #18)
> (In reply to Blake Wu [:bwu][:blakewu] from comment #17)
> > Comment on attachment 8610839 [details] [diff] [review]
> > patch part 2 - Make video decoder allocation async
> >
> > Review of attachment 8610839 [details] [diff] [review]:
> > -----------------------------------------------------------------
> >
> > Looks good to me....for video case.
> > How about audio part? I didn't find the part to create audio codec. Did I
> > miss something?
>
> |AskMediaCodecAndWait()| for audio and the new function
> |AsyncAskMediaCodec()| for video.
Yeah. Just found it. Thanks!
I thought AskMediaCodecAndWait is removed. This two function names look easily confused to me...
Maybe it would be better to use the same function to create audio and video codec. That would be more readable.
Comment 20•11 years ago
|
||
Comment on attachment 8610839 [details] [diff] [review]
patch part 2 - Make video decoder allocation async
Review of attachment 8610839 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me!
Just some suggestions in comment 19.
Attachment #8610839 -
Flags: review?(bwu) → review+
| Assignee | ||
Comment 21•11 years ago
|
||
(In reply to Blake Wu [:bwu][:blakewu] from comment #16)
> (In reply to Sotaro Ikeda [:sotaro] from comment #15)
> > I actually do not understand why AskMediaCodecAndWait() was started to be
> > used for video codec instead of fixing the problem correctly.
> AFAIK, originally ayang intended to remove/simplify those waiting and
> reserving coded resource codes from MediaDecoder and MDSM to readers. This
> codec reserving and waiting mechanism should be platform specific and would
> be better *not* to be exposed to the upper layer(MediaDecoder and MDSM).
>
> Anyway, after finding the problem in bug 1168813 and the blocked behavior
> may cause the potential problem in the future as you mentioned, now I am
> clear and also agree with you that we should revert AskMediaCodecAndWait and
> use MediaPromise for the waiting resource which also simplifies the codes in
> MediaDecoder and MDSM. Awesome and thanks!
Thanks for the clarification!
| Assignee | ||
Comment 22•11 years ago
|
||
(In reply to Blake Wu [:bwu][:blakewu] from comment #19)
> (In reply to Benjamin Chen [:bechen] from comment #18)
> > (In reply to Blake Wu [:bwu][:blakewu] from comment #17)
> > > Comment on attachment 8610839 [details] [diff] [review]
> > > patch part 2 - Make video decoder allocation async
> > >
> > > Review of attachment 8610839 [details] [diff] [review]:
> > > -----------------------------------------------------------------
> > >
> > > Looks good to me....for video case.
> > > How about audio part? I didn't find the part to create audio codec. Did I
> > > miss something?
> >
> > |AskMediaCodecAndWait()| for audio and the new function
> > |AsyncAskMediaCodec()| for video.
> Yeah. Just found it. Thanks!
> I thought AskMediaCodecAndWait is removed. This two function names look
> easily confused to me...
> Maybe it would be better to use the same function to create audio and video
> codec. That would be more readable.
I am going to put off it to another bug.
| Assignee | ||
Comment 23•11 years ago
|
||
Apply the comment.
Attachment #8610839 -
Attachment is obsolete: true
Attachment #8612280 -
Flags: review+
| Assignee | ||
Comment 24•11 years ago
|
||
Comment 25•11 years ago
|
||
Comment 26•11 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•