Closed
Bug 1320618
Opened 8 years ago
Closed 8 years ago
Check if codec supports adaptive playback to determine the decoder support recycling or not
Categories
(Firefox for Android Graveyard :: Audio/Video, defect, P1)
Firefox for Android Graveyard
Audio/Video
Tracking
(firefox52 fixed, firefox53 fixed)
RESOLVED
FIXED
Firefox 53
People
(Reporter: JamesCheng, Assigned: JamesCheng)
References
Details
Attachments
(1 file, 1 obsolete file)
This bug is spawned by bug Bug 1299105 comment 34,
Since current checkSupportsAdaptivePlayback API[1] only allowed passing MediaCodec instance to ask...but for remote decoding design, we only have this instance on remote process(and in Java), it is not easy to handle in "C++" side... I should figure out more easy way to handle this, I don't want to add new interface on AIDL for IPC.
[1] checkSupportsAdaptivePlayback
http://searchfox.org/mozilla-central/rev/9a3ab17838f039aab023837d905115f8990e442e/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java#58
Updated•8 years ago
|
Priority: -- → P1
Assignee | ||
Comment 1•8 years ago
|
||
Hi John,
I found that for local decoding case we create mediacodec by mimetype[1] but the mimeType is translated by "TranslateMimeType". For remote case, we used the mimetype extracted from MediaFormat.
Can we used the same approach(from MediaFormat) for both case?
If so, I would like to change the API
"public static boolean checkSupportsAdaptivePlayback(MediaCodec aCodec, String aMimeType)" into
"public static boolean checkSupportsAdaptivePlayback(MediaFormat aFormat)"
which can be used to both remote and local design to implement the check supporting API asking if the decoder supports recycling(requested by bug 1299105 comment 34 and comment 37).
Thanks.
[1]
http://searchfox.org/mozilla-central/rev/957458d8fa2328c2a760dbb30e7f1f1efa55b4d0/dom/media/platforms/android/MediaCodecDataDecoder.cpp#48
[2]
http://searchfox.org/mozilla-central/rev/9a3ab17838f039aab023837d905115f8990e442e/mobile/android/base/java/org/mozilla/gecko/media/Codec.java#281
Flags: needinfo?(jolin)
Assignee | ||
Updated•8 years ago
|
Flags: needinfo?(jolin)
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8815201 -
Flags: review?(jolin)
Assignee | ||
Comment 3•8 years ago
|
||
Hi John,
Please ignore comment 1 and help to review the part1 patch.
I will provide part2 patch like
Check support when I got MediaFormat instance
mIsSupportAdaptivePlayback = java::HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback(mFormat);
and
bool SupportDecoderRecycling() const override
{
return mIsSupportAdaptivePlayback;
}
if the part1 is being acceptable.
Thank you.
Comment hidden (mozreview-request) |
Comment 5•8 years ago
|
||
Passing MediaFormat to a method named CheckSupportsAdaptivePlayback doesn't make sense to me and the patch doesn't address bug 1317239 comment 4. I suggest leaving it as is and do the checking in CodecProxy for remote decoder.
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8815201 [details]
Bug 1320618 - Check if codec supports adaptive playback to determine the decoder support recycling or not.
https://reviewboard.mozilla.org/r/96224/#review96666
Attachment #8815201 -
Flags: review?(jolin) → review-
Assignee | ||
Comment 7•8 years ago
|
||
(In reply to John Lin [:jolin][:jhlin] from comment #5)
> Passing MediaFormat to a method named CheckSupportsAdaptivePlayback doesn't
> make sense to me and the patch doesn't address bug 1317239 comment 4. I
For solving bug 1317239 comment 4, I just want all logic use the same mimetype(From MediaFormat) and approximately get the same decoder for all callers. Anyway it is not robust.
> suggest leaving it as is and do the checking in CodecProxy for remote
> decoder.
IIUC,
I should add a new interface in AIDL since MediaCodec instance only exists in decoder process(call it bool checkadaptive()).
And call remote.checkadaptive() after "configure" called[1]
Do you agree with adding a sync RPC call to for just asking if it supports adaptive playback?
[1]
http://searchfox.org/mozilla-central/rev/d98418da69edeb1f2f8e6f3840157fae1512f89b/mobile/android/base/java/org/mozilla/gecko/media/CodecProxy.java#110
Flags: needinfo?(jolin)
Comment 8•8 years ago
|
||
(In reply to James Cheng[:JamesCheng] from comment #7)
> (In reply to John Lin [:jolin][:jhlin] from comment #5)
> > Passing MediaFormat to a method named CheckSupportsAdaptivePlayback doesn't
> > make sense to me and the patch doesn't address bug 1317239 comment 4. I
> For solving bug 1317239 comment 4, I just want all logic use the same
> mimetype(From MediaFormat) and approximately get the same decoder for all
> callers. Anyway it is not robust.
>
> > suggest leaving it as is and do the checking in CodecProxy for remote
> > decoder.
> IIUC,
> I should add a new interface in AIDL since MediaCodec instance only exists
> in decoder process(call it bool checkadaptive()).
Yes. isAdaptivePlaybackSupported() sounds more clear to me.
>
> And call remote.checkadaptive() after "configure" called[1]
Or introduce a new method CodecProxy.isAdaptivePlaybackSupported() that calls it, then overriding RemoteVideoDecoder::SupportDecoderRecycling() to call that.
Also, cache the value in CodecProxy or RemoteVideoDecoder to avoid multiple IPC calls.
>
> Do you agree with adding a sync RPC call to for just asking if it supports
> adaptive playback?
>
> [1]
> http://searchfox.org/mozilla-central/rev/
> d98418da69edeb1f2f8e6f3840157fae1512f89b/mobile/android/base/java/org/
> mozilla/gecko/media/CodecProxy.java#110
Sure.
Flags: needinfo?(jolin)
Assignee | ||
Comment 9•8 years ago
|
||
Thank you for your feedback.
I will provide a new patch for that!
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8815205 -
Attachment is obsolete: true
Comment 11•8 years ago
|
||
mozreview-review |
Comment on attachment 8815201 [details]
Bug 1320618 - Check if codec supports adaptive playback to determine the decoder support recycling or not.
https://reviewboard.mozilla.org/r/96224/#review96982
LGTM. Please fix the issue in `JellyBeanAsyncCodec` before landing.
::: dom/media/platforms/android/MediaCodecDataDecoder.cpp:386
(Diff revision 2)
> MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__));
> return NS_ERROR_FAILURE;
> }
>
> // Check if the video codec supports adaptive playback or not.
> - if (aSurface && java::HardwareCodecCapabilityUtils::CheckSupportsAdaptivePlayback(
> + if (aSurface) {
Nit: this is for video decoder only and would be better to be put in VideoDataDecoder code rather than common init code.
::: dom/media/platforms/android/RemoteDataDecoder.cpp:284
(Diff revision 2)
>
> layers::ImageContainer* mImageContainer;
> const VideoInfo& mConfig;
> RefPtr<AndroidSurfaceTexture> mSurfaceTexture;
> DurationQueue mInputDurations;
> + bool mIsCodecSupportAdaptivePlayback = false;
Nit: or `Maybe<bool>` and lazily init the value in `SupportDecoderRecycling()`
::: mobile/android/base/java/org/mozilla/gecko/media/JellyBeanAsyncCodec.java:303
(Diff revision 2)
>
> @Override
> public void configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags) {
> assertCallbacks();
>
> // Video decoder should config with adaptive playback capability.
Please move this to `Codec.configure()` to avoid (future) duplicating code in other `AsyncCodec` subclasses.
Attachment #8815201 -
Flags: review?(jolin) → review+
Assignee | ||
Comment 12•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8815201 [details]
Bug 1320618 - Check if codec supports adaptive playback to determine the decoder support recycling or not.
https://reviewboard.mozilla.org/r/96224/#review96982
> Nit: this is for video decoder only and would be better to be put in VideoDataDecoder code rather than common init code.
But the mFormat need to be set before the MeidaCodec configure called, and checking the adaptive playback API needs MediaCodec instance...
So it seems I need to put the check in this section.
> Nit: or `Maybe<bool>` and lazily init the value in `SupportDecoderRecycling()`
will do it, thanks.
> Please move this to `Codec.configure()` to avoid (future) duplicating code in other `AsyncCodec` subclasses.
But in Codec.configure, I don't have MediaCodec instance, I can only do it in the JellyBeanAsyncCodec.configure.
Did I misunderstand anything?
Comment 13•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8815201 [details]
Bug 1320618 - Check if codec supports adaptive playback to determine the decoder support recycling or not.
https://reviewboard.mozilla.org/r/96224/#review96982
> But in Codec.configure, I don't have MediaCodec instance, I can only do it in the JellyBeanAsyncCodec.configure.
> Did I misunderstand anything?
What I meant is adding a method `AsyncCodec.isAdaptivePlaybackSupported` which JellyBeanAsyncCodec implements and it calls `CheckSupportsAdaptivePlayback()`. `Codec.configure()` then inserts max width/height.
Comment 14•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8815201 [details]
Bug 1320618 - Check if codec supports adaptive playback to determine the decoder support recycling or not.
https://reviewboard.mozilla.org/r/96224/#review96982
> But the mFormat need to be set before the MeidaCodec configure called, and checking the adaptive playback API needs MediaCodec instance...
> So it seems I need to put the check in this section.
Yes. It will require rewriting `VideoDataDecoder::Init()` and `MediaCodecDataDecoder::InitDecoder()`. This is just a nit so I'm okay if you don't change it.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 17•8 years ago
|
||
Thank you for review.
Attach try result
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6723fa0fb06fbc39d6b71b52e66f616df8afdfbc
Comment 18•8 years ago
|
||
Pushed by jacheng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/803eb84eb9a6
Check if codec supports adaptive playback to determine the decoder support recycling or not. r=jolin
Comment 19•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Comment 20•8 years ago
|
||
bugherder uplift |
Uplifted to Aurora as part of the roll-up patch in bug 1299105.
https://hg.mozilla.org/releases/mozilla-aurora/rev/783ca8448b09
status-firefox52:
--- → fixed
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•