Closed Bug 1022434 Opened 5 years ago Closed 5 years ago

[EME] Expose decryption data in MP4Samples

Categories

(Core :: Audio/Video, defect)

29 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: cpearce, Assigned: ajones)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file, 3 obsolete files)

Our demuxer must expose the info we'll need to pass to the CDM in order to decrypt MP4 samples.
Specifics here: https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/cenc-format.html

Requirements:
* Each time one or more consecutive PSSH boxes are encountered, the demuxer should concatenate the PSSH boxes and signal the MP4Reader (via a callback say). The MP4Reader will then forward the PSSH boxes (the "initData") onto the EME/JS APIs. PSSH boxes that are not directly following each other should be sent in a separate callback.
* Each MP4Sample needs to either be flagged as non-encrypted, or if it is encrypted, it must have a 16 byte KeyId, and a list of SubsampleEntries. The SubsampleEntries are (roughly) a list of the form [($numClearBytes, $numEncryptedBytes), ...]. See the URL above for more details.
Assignee: nobody → ajones
Status: NEW → ASSIGNED
Attachment #8441107 - Attachment is obsolete: true
Comment on attachment 8441827 [details] [diff] [review]
Extract crypto information from MP4 demuxer

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

::: media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ +25,5 @@
> +{
> +  PsshInfo() {}
> +  PsshInfo(PsshInfo&& aOther) : uuid(aOther.uuid), data(Move(aOther.data)) {}
> +  mozilla::Array<uint8_t, 16> uuid;
> +  mozilla::Vector<uint8_t> data;

It would good if you used nsTArray<uint8_t> consistently in the demuxer, it would make handling these easier.

@@ +61,5 @@
> +public:
> +  void Update(stagefright::sp<stagefright::MetaData>& aMetaData);
> +
> +  mozilla::Vector<size_t> plain_sizes;
> +  mozilla::Vector<size_t> encrypted_sizes;

If these values can't be larger than uint32_t, then it would be good if you could use uint32_t instead of size_t here, so that we can copy these inter-process around without having to worry about the sizeof(size_t).
Attached patch Patch: Extra stuff needed (obsolete) — Splinter Review
I had to add this stuff on top of ajone's patch to make decryption work.

1. I had to increment the first subsample clear byte offset by the size of the ADTS header added to AAC samples when the ESDS to ADTS conversion is done, otherwise the decryption starts 7 and finishes bytes too early, so the decryption output is garbage.
2. The MPEG4Extractor doesn't extract audio config data for encrypted audio streams, only non encrypted ones. We want it to.
* * *
Bug 1022434 - "[EME] Expose decryption data in MP4Samples" []
Attachment #8457748 - Flags: review?(cpearce)
Attachment #8441827 - Attachment is obsolete: true
Comment on attachment 8457748 [details] [diff] [review]
Extract crypto information from MP4 demuxer

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

::: media/libstagefright/binding/include/mp4_demuxer/DecoderData.h
@@ +38,5 @@
> +    valid = DoUpdate(aMetaData);
> +  }
> +
> +  bool valid;
> +  mozilla::Vector<PsshInfo> pssh;

nsTArray here too please. There's no need to have two different container types used here.
Attachment #8457748 - Flags: review?(cpearce) → review+
Attachment #8454261 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/274a3f27b497
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.