From fe9c4201f323c5b14333c44bff939578bd267e46 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Thu, 6 Nov 2014 15:13:35 -0800 Subject: [PATCH] Remove the restriction that key response contains all keys Also set fragment_duration in mvex. Change-Id: I9584c17569b2eb9b75d060284288c44f64b76821 --- README.md | 6 +++--- packager/media/base/key_source.cc | 2 ++ packager/media/base/key_source.h | 3 ++- packager/media/base/widevine_key_source.cc | 6 +++--- packager/media/formats/mp4/segmenter.cc | 1 + 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6295144a1f..df240557f8 100644 --- a/README.md +++ b/README.md @@ -332,7 +332,7 @@ Demux video from the input and generate an encrypted fragmented mp4 using Widevi packager input=sintel.mp4,stream=video,output=encrypted_sintel.mp4 \ --enable_widevine_encryption \ --key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \ ---content_id "content_sintel" \ +--content_id "3031323334353637" \ --signer "widevine_test" \ --rsa_signing_key_path "widevine_test_private.der" ``` @@ -342,7 +342,7 @@ The program also supports AES signing. Here is an example with encryption key ro packager input=sintel.mp4,stream=video,output=encrypted_sintel.mp4 \ --enable_widevine_encryption \ --key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \ ---content_id "content_sintel" \ +--content_id "3031323334353637" \ --signer "widevine_test" \ --aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \ --aes_signing_iv "d58ce954203b7c9a9a9d467f59839249" \ @@ -355,7 +355,7 @@ packager input=sintel.wvm,stream=video,output=encrypted_sintel.mp4 \ --enable_widevine_decryption \ --enable_widevine_encryption \ --key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \ ---content_id "01020304050607" \ +--content_id "3031323334353637" \ --signer "widevine_test" \ --rsa_signing_key_path "widevine_test_private.der" ``` diff --git a/packager/media/base/key_source.cc b/packager/media/base/key_source.cc index a222c0717b..c4a07eadc5 100644 --- a/packager/media/base/key_source.cc +++ b/packager/media/base/key_source.cc @@ -111,6 +111,8 @@ KeySource::TrackType KeySource::GetTrackTypeFromString( return TRACK_TYPE_HD; if (track_type_string == "AUDIO") return TRACK_TYPE_AUDIO; + if (track_type_string == "UNSPECIFIED") + return TRACK_TYPE_UNSPECIFIED; LOG(WARNING) << "Unexpected track type: " << track_type_string; return TRACK_TYPE_UNKNOWN; } diff --git a/packager/media/base/key_source.h b/packager/media/base/key_source.h index 9fc83505c2..fa3f363d25 100644 --- a/packager/media/base/key_source.h +++ b/packager/media/base/key_source.h @@ -33,7 +33,8 @@ class KeySource { TRACK_TYPE_SD = 1, TRACK_TYPE_HD = 2, TRACK_TYPE_AUDIO = 3, - NUM_VALID_TRACK_TYPES = 3 + TRACK_TYPE_UNSPECIFIED = 4, + NUM_VALID_TRACK_TYPES = 4 }; virtual ~KeySource(); diff --git a/packager/media/base/widevine_key_source.cc b/packager/media/base/widevine_key_source.cc index eca563f996..f310de713a 100644 --- a/packager/media/base/widevine_key_source.cc +++ b/packager/media/base/widevine_key_source.cc @@ -459,9 +459,9 @@ bool WidevineKeySource::ExtractEncryptionKey( const base::ListValue* tracks; RCHECK(license_dict->GetList("tracks", &tracks)); - RCHECK(enable_key_rotation - ? tracks->GetSize() >= NUM_VALID_TRACK_TYPES * crypto_period_count_ - : tracks->GetSize() >= NUM_VALID_TRACK_TYPES); + // Should have at least one track per crypto_period. + RCHECK(enable_key_rotation ? tracks->GetSize() >= 1 * crypto_period_count_ + : tracks->GetSize() >= 1); int current_crypto_period_index = first_crypto_period_index_; diff --git a/packager/media/formats/mp4/segmenter.cc b/packager/media/formats/mp4/segmenter.cc index d27042af8f..f4b479ffb0 100644 --- a/packager/media/formats/mp4/segmenter.cc +++ b/packager/media/formats/mp4/segmenter.cc @@ -230,6 +230,7 @@ Status Segmenter::Finalize() { if (track->header.duration > moov_->header.duration) moov_->header.duration = track->header.duration; } + moov_->extends.header.fragment_duration = moov_->header.duration; return DoFinalize(); }