-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for CENC ClearKey #2372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good aside from one comment (see inline). Thanks!
@@ -1192,7 +1192,7 @@ private static DrmInitData getDrmInitDataFromAtoms(List<Atom.LeafAtom> leafChild | |||
if (uuid == null) { | |||
Log.w(TAG, "Skipped pssh atom (failed to extract uuid)"); | |||
} else { | |||
schemeDatas.add(new SchemeData(uuid, MimeTypes.VIDEO_MP4, psshData)); | |||
schemeDatas.add(new SchemeData(uuid, MimeTypes.CENC, psshData)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to be necessary? I have a hunch it might break Widevine/PlayReady on some earlier API levels also, although I didn't confirm this. If it works without, can we just leave it how it was and also remove the CENC constant from MimeTypes.java?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank for your replay.
It accept "video/mp4" only on Android 7.1.1 or higher.
https://android.googlesource.com/platform/frameworks/av/+/01a977aa75c296c5467024a7beac50cbd4ed0335%5E%21/#F4
https://android.googlesource.com/platform/frameworks/av/+/android-5.0.0_r1/drm/mediadrm/plugins/clearkey/InitDataParser.cpp#48
Should I change the definition class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should also add this for the case where the pssh is parsed from the manifest. That is in DashManifestParser#parseContentProtection
.
Otherwise if you follow @ojw28 ´s tip about doing this in the DrmSessionManager, that would cover both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right.
Thanks for clarification in your previous response (although it seems to have disappeared somehow). I don't think you should modify It feels to me that you're trying to work around a bug in the underlying CDM implementation on older versions of Android. The correct place to do that is probably
That way the workaround will be applied correctly regardless of where the media is coming from (e.g. if another extractor implementation is used). |
Sorry for the late reply. Oh, I see. Why is SDK_INT 23? android-7.1.1_r1 |
|
It's difficult to judge with What do you think?
|
@@ -337,6 +343,12 @@ public void setMode(@Mode int mode, byte[] offlineLicenseKeySetId) { | |||
schemeInitData = psshData; | |||
} | |||
} | |||
if (C.CENC_UUID.equals(uuid) && MimeTypes.VIDEO_MP4.equals(schemeMimeType)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should handle audio/mp4 as well for completeness, I think. I'd also rather there were a capping SDK level after which the workaround is not applied. We shouldn't be applying workarounds for platform issues to future platform releases; we should be making sure the problems are fixed in the platform (which it appears has been done).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for the late reply. I updated again.
Thanks! I simplified this somewhat in 3bb08e5. I think it's equivalent, except that it always replaces schemeMimeType to "cenc" on API level 25. I think this is fine - my main concern was just not applying the workaround indefinitely, which is achieved by capping to not apply on API levels above 25. Let me know if I accidentally broke something! |
Also corrected some naming in 5fe5076. |
No problem. |
Don't you like MediaDrm.isCryptoSchemeSupported ? |
I don't dislike it. It just seems unnecessarily complicated to use it just on one API level. |
Right, got it. Thanks! |
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=148344124
@wasabeef - The sample asset you added in this request appears to no longer work. Could you update or remove it? Thanks. |
Support CENC ClearKey
https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html
See issue #2361