Commit d5069c84 authored by John Rummell's avatar John Rummell Committed by Commit Bot

[media] Add versions of bear-640x360-v_frag.mp4 encrypted with different schemes

These were generated using Shaka Packager 2.0.0.

BUG=657957
TEST=new browser_tests pass

Change-Id: I1ea784700c0d96b549f2a40221b92dd9af807d4a
Reviewed-on: https://chromium-review.googlesource.com/935193
Commit-Queue: John Rummell <jrummell@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541963}
parent a245b5db
......@@ -385,6 +385,17 @@ class EncryptedMediaTestExperimentalCdmInterface
expected_title);
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
void TestMP4EncryptionPlayback(const std::string& key_system,
const std::string& media_file,
const std::string& expected_title) {
// MP4 playback is only supported with MSE.
RunEncryptedMediaTest(kDefaultEmePlayer, media_file, kMP4VideoOnly,
key_system, SrcType::MSE, kNoSessionToLoad, false,
PlayCount::ONCE, expected_title);
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
......@@ -653,6 +664,15 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4) {
TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_MDAT) {
// MP4 without MSE is not support yet, http://crbug.com/170793.
if (CurrentSourceType() != SrcType::MSE) {
DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
return;
}
TestSimplePlayback("bear-640x360-v_frag-cenc-mdat.mp4", kMP4VideoOnly);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
// MP4 without MSE is not support yet, http://crbug.com/170793.
if (CurrentSourceType() != SrcType::MSE) {
......@@ -827,4 +847,32 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaTestExperimentalCdmInterface,
EXPECT_EQ(3, num_received_message_types);
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// ClearKey key system is covered in
// content/browser/media/encrypted_media_browsertest.cc.
IN_PROC_BROWSER_TEST_F(EncryptedMediaTestExperimentalCdmInterface,
Playback_Encryption_CENC) {
TestMP4EncryptionPlayback(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cenc.mp4", media::kEnded);
}
IN_PROC_BROWSER_TEST_F(EncryptedMediaTestExperimentalCdmInterface,
Playback_Encryption_CBC1) {
TestMP4EncryptionPlayback(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cbc1.mp4", media::kError);
}
IN_PROC_BROWSER_TEST_F(EncryptedMediaTestExperimentalCdmInterface,
Playback_Encryption_CENS) {
TestMP4EncryptionPlayback(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cens.mp4", media::kError);
}
IN_PROC_BROWSER_TEST_F(EncryptedMediaTestExperimentalCdmInterface,
Playback_Encryption_CBCS) {
TestMP4EncryptionPlayback(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cbcs.mp4", media::kError);
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
......@@ -49,6 +49,9 @@ const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\"";
const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\"";
const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\"";
const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\"";
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.64001E\"";
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
// EME-specific test results and errors.
const char kEmeKeyError[] = "KEYERROR";
......@@ -140,6 +143,19 @@ class EncryptedMediaTest : public MediaBrowserTest,
src_type, media::kEnded);
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
void TestMP4EncryptionPlayback(const std::string& media_file,
const std::string& expected_title) {
if (CurrentSourceType() != SrcType::MSE) {
DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
return;
}
RunEncryptedMediaTest(kDefaultEmePlayer, media_file, kMP4VideoOnly,
CurrentKeySystem(), SrcType::MSE, expected_title);
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
protected:
// We want to fail quickly when a test fails because an error is encountered.
void AddTitlesToAwait(content::TitleWatcher* title_watcher) override {
......@@ -270,6 +286,28 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_FrameSizeChangeVideo) {
TestFrameSizeChange();
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENC) {
TestMP4EncryptionPlayback("bear-640x360-v_frag-cenc.mp4", media::kEnded);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBC1) {
TestMP4EncryptionPlayback("bear-640x360-v_frag-cbc1.mp4", media::kError);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENS) {
TestMP4EncryptionPlayback("bear-640x360-v_frag-cens.mp4", media::kError);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBCS) {
#if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
TestMP4EncryptionPlayback("bear-640x360-v_frag-cbcs.mp4", media::kEnded);
#else
TestMP4EncryptionPlayback("bear-640x360-v_frag-cbcs.mp4", media::kError);
#endif
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) {
RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
kWebMVorbisAudioOnly, "com.example.foo", SrcType::MSE,
......
......@@ -111,10 +111,32 @@ bear-320x240-opus-av_enc-av.webm - bear-vp9-opus.webm with audio & video encrypt
bear-320x240-opus-av_enc-v.webm - bear-vp9-opus.webm with video track encrypted using key ID [1] and key[2].
bear-640x360-a_frag-cenc.mp4 - A fragmented MP4 version of the audio track of bear-640x360.mp4 encrypted (ISO CENC) using key ID [1] and key [2].
bear-640x360-a_frag-cenc-key_rotation.mp4 - A fragmented MP4 version of the audio track of bear-640x360.mp4 encrypted (ISO CENC) using key ID [1] and key [2] with key rotation [3].
bear-640x360-v_frag-cenc.mp4 - A fragmented MP4 version of the video track of bear-640x360.mp4 encrypted (ISO CENC) using key ID [1] and key [2] and with sample encryption auxiliary information in the beginning of mdat box.
bear-640x360-v_frag-cenc-mdat.mp4 - A fragmented MP4 version of the video track of bear-640x360.mp4 encrypted (ISO CENC) using key ID [1] and key [2] and with sample encryption auxiliary information in the beginning of mdat box.
bear-640x360-v_frag-cenc-senc.mp4 - Same as above, but with sample encryption information stored in SampleEncryption ('senc') box.
bear-640x360-v_frag-cenc-senc-no-saiz-saio.mp4 - Same as above, but without saiz and saio boxes.
bear-640x360-v_frag-cenc-key_rotation.mp4 - A fragmented MP4 version of the video track of bear-640x360.mp4 encrypted (ISO CENC) using key ID [1] and key [2] with key rotation [3].
bear-640x360-v_frag-cenc.mp4
bear-640x360-v_frag-cbc1.mp4
bear-640x360-v_frag-cbcs.mp4
bear-640x360-v_frag-cens.mp4
- Encrypted versions of bear-640x360-v_frag.mp4, encrypted by Shaka Packager
using key ID [1] and key [2]. Sample encryption information stored in
SampleEncryption ('senc') box (in each encrypted fragment).
Shaka Packager: https://github.com/google/shaka-packager/releases/tag/v2.0.0
Command: (replace both places of 'cenc' with desired scheme)
packager in=bear-640x360-v_frag.mp4,stream=video,output=bear-640x360-v-cenc.mp4
--enable_raw_key_encryption
--protection_scheme cenc
--clear_lead 0.5
--segment_duration 0.5
--keys label=:key_id=30313233343536373839303132333435:key=ebdd62f16814d27b68ef122afce4ae3c
--pssh 000000327073736800000000EDEF8BA979D64ACEA3C827DCD51D21ED000000121210303132333435363738393031323334350000003470737368010000001077EFECC0B24D02ACE33C1E52E2FB4B000000013031323334353637383930313233343500000000
'pssh' data includes entries for both Widevine and Common SystemID [5].
It was generated from concatenating the output of:
shaka/packager/tools/pssh/pssh-box.py --widevine-system-id --key-id 30313233343536373839303132333435 --hex
shaka/packager/tools/pssh/pssh-box.py --common-system-id --key-id 30313233343536373839303132333435 --hex
bear-a_enc-a.webm - bear-320x240-audio-only.webm encrypted using key ID [1] and key [2].
frame_size_change-av_enc-v.webm - third_party/WebKit/LayoutTests/media/resources/frame_size_change.webm encrypted using key ID [1] and key [2].
......@@ -136,6 +158,7 @@ bear-1280x720-hls-with-CAT.ts: same as bear-1280x720-hls.ts but with an extra TS
std::rotate for every new crypto period. This is only for testing. The
actual key rotation algorithm is often much more complicated.
[4] http://www.webmproject.org/docs/webm-encryption/#46-subsample-encrypted-block-format
[5] https://w3c.github.io/encrypted-media/format-registry/initdata/cenc.html#common-system
// Container Tests (additional containers derived from bear.ogv)
bear.ac3 -- created using "avconv -i bear.ogv -f ac3 -b 192k bear.ac3".
......
......@@ -1848,7 +1848,7 @@ TEST_P(MSEPipelineIntegrationTest, ConfigChange_MP4) {
MAYBE_EME_TEST_P(MSEPipelineIntegrationTest,
MAYBE_EME(ConfigChange_Encrypted_MP4_CENC_VideoOnly)) {
MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
MockMediaSource source("bear-640x360-v_frag-cenc-mdat.mp4", kMP4Video,
kAppendWholeFile);
FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
EXPECT_EQ(PIPELINE_OK,
......@@ -1948,7 +1948,7 @@ TEST_P(MSEPipelineIntegrationTest,
// Config changes from encrypted to clear are not currently supported.
MAYBE_EME_TEST_P(MSEPipelineIntegrationTest,
MAYBE_EME(ConfigChange_EncryptedThenClear_MP4_CENC)) {
MockMediaSource source("bear-640x360-v_frag-cenc.mp4", kMP4Video,
MockMediaSource source("bear-640x360-v_frag-cenc-mdat.mp4", kMP4Video,
kAppendWholeFile);
FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
EXPECT_EQ(PIPELINE_OK,
......@@ -2203,6 +2203,25 @@ MAYBE_EME_TEST_P(
Stop();
}
// Older packagers saved sample encryption auxiliary information in the
// beginning of mdat box.
MAYBE_EME_TEST_P(MSEPipelineIntegrationTest,
MAYBE_EME(EncryptedPlayback_MP4_CENC_MDAT_Video)) {
MockMediaSource source("bear-640x360-v_frag-cenc-mdat.mp4", kMP4Video,
kAppendWholeFile);
FakeEncryptedMedia encrypted_media(new KeyProvidingApp());
EXPECT_EQ(PIPELINE_OK,
StartPipelineWithEncryptedMedia(&source, &encrypted_media));
source.EndOfStream();
Play();
ASSERT_TRUE(WaitUntilOnEnded());
source.Shutdown();
Stop();
}
MAYBE_EME_TEST_P(MSEPipelineIntegrationTest,
MAYBE_EME(EncryptedPlayback_MP4_CENC_SENC_Video)) {
MockMediaSource source("bear-640x360-v_frag-cenc-senc.mp4", kMP4Video,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment