Closed Bug 1630381 Opened 2 years ago Closed 2 years ago

Create encrypted avc3 clearkey testcase


(Core :: Audio/Video: Playback, task, P3)




Tracking Status
firefox77 --- fixed


(Reporter: bryce, Assigned: bryce)



(Whiteboard: [media-tests])


(5 files)

We could use a testcase to cover bug 1560092. I've got some of the test media from that case that should be suitable.

Whiteboard: [media-tests]

This has been a little more involved than I initially expected. Providing details here for posterity.

  • I'm adapting media from this test for our tests.
    • That media doesn't have clearkey info in the pssh box, it only has widevine info. For our test harness we currently need the clearkey info to come via pssh, rather than by another channel (such as keyids, which is how the test page appears to pass them in using shaka-player).
    • So I've manually built the required pssh box based on the keyid:key paring 10000000100010001000100000000001:3A2A1B68DD2BD9B2EEB25E84C4776668 (only the id goes in the box).
    • I've saved the pssh box binary data to a file newpssh and used Bento4's mp4edit to replace the pssh in the test file mp4edit.exe --replace moov/pssh:newpssh big-buck-bunny-cenc-avc3-init.mp4.orig big-buck-bunny-cenc-avc3-init.mp4.rewritten-pssh

The new pssh is created as follows:

00 00 00 34                                         <- Box length
70 73 73 68                                         <- "pssh"
01                                                  <- Version 
00 00 00                                            <- Flags
10 77 EF EC C0 B2 4D 02 AC E3 3C 1E 52 E2 FB 4B     <- clearkey id
00 00 00 01                                         <- #keyids
10 00 00 00 10 00 10 00 10 00 10 00 00 00 00 01     <- keyid
00 00 00 00                                         <- Length of further data (0)

I'll attach the files involved here for reference.

Original init segment from the test stream

Rewritten init segment

Attached file newpssh

Lovingly hand crafted pssh box for clearkey data

First media segment for test stream

Something I've found while testing this is that most tests in our test suite don't fail on this as I'd expect if I partially revert the changes in bug 1617929 (specifically if I revert the last patch). If I do that, the MediaChangeMonitor will fail to find an SPS, and will never create a decoder. However, this results in the monitor eating those frames, so the tests skip over them because of this code. This results in many tests still passing, as at the video element level it looks like the stream has played -- current time, duration, and played ranges all point to a stream being played correctly.

The one saving grace is that the waiting for key test fails if we don't create a decoder. I believe this is because without an EME decoder we never correctly identify that we're waiting on a key to decode, so we timeout.

It may make sense to follow this up at some stage with a gtest that more specifically targets our ability to extract extra data from avc3 samples.

Pushed by
Add avc3 clearkey test. r=alwu,dminor
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.