diff options
author | dougsteed <dougsteed@chromium.org> | 2016-03-11 16:04:30 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-12 00:05:22 +0000 |
commit | 8d5275f7bbb6f79c83829a7931f1500128ef3f8f (patch) | |
tree | 06d53aa908b22da47f819afbf815aa941f709ef9 /media/formats/webm | |
parent | c5bf1a9a84aadcf927f94e806f4647d65e3da2c1 (diff) | |
download | chromium_src-8d5275f7bbb6f79c83829a7931f1500128ef3f8f.zip chromium_src-8d5275f7bbb6f79c83829a7931f1500128ef3f8f.tar.gz chromium_src-8d5275f7bbb6f79c83829a7931f1500128ef3f8f.tar.bz2 |
media config: expand is_encrypted to a struct.
Provide more complete encryption metadata, rather than
just a bool. EncryptionScheme also allows specification
of the mode and the pattern, as will be allowed by
CENC (ISO's Common Encryption standard), 3rd Edition.
BUG=568326
Committed: https://crrev.com/c9d2206c62f65e29b141e08df2b2dcb88f54162f
Cr-Commit-Position: refs/heads/master@{#380710}
Review URL: https://codereview.chromium.org/1490613005
Cr-Commit-Position: refs/heads/master@{#380791}
Diffstat (limited to 'media/formats/webm')
-rw-r--r-- | media/formats/webm/webm_audio_client.cc | 17 | ||||
-rw-r--r-- | media/formats/webm/webm_audio_client.h | 7 | ||||
-rw-r--r-- | media/formats/webm/webm_tracks_parser.cc | 12 | ||||
-rw-r--r-- | media/formats/webm/webm_video_client.cc | 4 | ||||
-rw-r--r-- | media/formats/webm/webm_video_client.h | 7 |
5 files changed, 24 insertions, 23 deletions
diff --git a/media/formats/webm/webm_audio_client.cc b/media/formats/webm/webm_audio_client.cc index fb6a723a..173d81f 100644 --- a/media/formats/webm/webm_audio_client.cc +++ b/media/formats/webm/webm_audio_client.cc @@ -29,7 +29,7 @@ bool WebMAudioClient::InitializeConfig( const std::vector<uint8_t>& codec_private, int64_t seek_preroll, int64_t codec_delay, - bool is_encrypted, + const EncryptionScheme& encryption_scheme, AudioDecoderConfig* config) { DCHECK(config); SampleFormat sample_format = kSampleFormatPlanarF32; @@ -78,16 +78,11 @@ bool WebMAudioClient::InitializeConfig( base::Time::kNanosecondsPerSecond); } - config->Initialize( - audio_codec, - sample_format, - channel_layout, - samples_per_second, - codec_private, - is_encrypted, - base::TimeDelta::FromMicroseconds( - (seek_preroll != -1 ? seek_preroll : 0) / 1000), - codec_delay_in_frames); + config->Initialize(audio_codec, sample_format, channel_layout, + samples_per_second, codec_private, encryption_scheme, + base::TimeDelta::FromMicroseconds( + (seek_preroll != -1 ? seek_preroll : 0) / 1000), + codec_delay_in_frames); return config->IsValidConfig(); } diff --git a/media/formats/webm/webm_audio_client.h b/media/formats/webm/webm_audio_client.h index fefa55f..06d7e0c 100644 --- a/media/formats/webm/webm_audio_client.h +++ b/media/formats/webm/webm_audio_client.h @@ -16,6 +16,7 @@ namespace media { class AudioDecoderConfig; +class EncryptionScheme; // Helper class used to parse an Audio element inside a TrackEntry element. class WebMAudioClient : public WebMParserClient { @@ -27,8 +28,8 @@ class WebMAudioClient : public WebMParserClient { void Reset(); // Initialize |config| with the data in |codec_id|, |codec_private|, - // |is_encrypted| and the fields parsed from the last audio track element this - // object was used to parse. + // |encryption_scheme| and the fields parsed from the last audio track element + // this object was used to parse. // Returns true if |config| was successfully initialized. // Returns false if there was unexpected values in the provided parameters or // audio track element fields. @@ -36,7 +37,7 @@ class WebMAudioClient : public WebMParserClient { const std::vector<uint8_t>& codec_private, const int64_t seek_preroll, const int64_t codec_delay, - bool is_encrypted, + const EncryptionScheme& encryption_scheme, AudioDecoderConfig* config); private: diff --git a/media/formats/webm/webm_tracks_parser.cc b/media/formats/webm/webm_tracks_parser.cc index 5ffa0aa..112427f 100644 --- a/media/formats/webm/webm_tracks_parser.cc +++ b/media/formats/webm/webm_tracks_parser.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" +#include "media/base/media_util.h" #include "media/base/timestamp_constants.h" #include "media/formats/webm/webm_constants.h" #include "media/formats/webm/webm_content_encodings.h" @@ -193,6 +194,9 @@ bool WebMTracksParser::OnListEnd(int id) { content_encodings()[0]->encryption_key_id(); } + EncryptionScheme encryption_scheme = + encryption_key_id.empty() ? Unencrypted() : AesCtrEncryptionScheme(); + if (track_type_ == kWebMTrackTypeAudio) { if (audio_track_num_ == -1) { audio_track_num_ = track_num_; @@ -208,7 +212,7 @@ bool WebMTracksParser::OnListEnd(int id) { DCHECK(!audio_decoder_config_.IsValidConfig()); if (!audio_client_.InitializeConfig( codec_id_, codec_private_, seek_preroll_, codec_delay_, - !audio_encryption_key_id_.empty(), &audio_decoder_config_)) { + encryption_scheme, &audio_decoder_config_)) { return false; } media_tracks_->AddAudioTrack(audio_decoder_config_, @@ -231,9 +235,9 @@ bool WebMTracksParser::OnListEnd(int id) { video_default_duration_ = default_duration_; DCHECK(!video_decoder_config_.IsValidConfig()); - if (!video_client_.InitializeConfig( - codec_id_, codec_private_, !video_encryption_key_id_.empty(), - &video_decoder_config_)) { + if (!video_client_.InitializeConfig(codec_id_, codec_private_, + encryption_scheme, + &video_decoder_config_)) { return false; } media_tracks_->AddVideoTrack(video_decoder_config_, diff --git a/media/formats/webm/webm_video_client.cc b/media/formats/webm/webm_video_client.cc index 6e57dfb..9d0435f 100644 --- a/media/formats/webm/webm_video_client.cc +++ b/media/formats/webm/webm_video_client.cc @@ -33,7 +33,7 @@ void WebMVideoClient::Reset() { bool WebMVideoClient::InitializeConfig( const std::string& codec_id, const std::vector<uint8_t>& codec_private, - bool is_encrypted, + const EncryptionScheme& encryption_scheme, VideoDecoderConfig* config) { DCHECK(config); @@ -93,7 +93,7 @@ bool WebMVideoClient::InitializeConfig( config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, coded_size, visible_rect, natural_size, codec_private, - is_encrypted); + encryption_scheme); return config->IsValidConfig(); } diff --git a/media/formats/webm/webm_video_client.h b/media/formats/webm/webm_video_client.h index dfdc5f6..d746df9 100644 --- a/media/formats/webm/webm_video_client.h +++ b/media/formats/webm/webm_video_client.h @@ -15,6 +15,7 @@ #include "media/formats/webm/webm_parser.h" namespace media { +class EncryptionScheme; class VideoDecoderConfig; // Helper class used to parse a Video element inside a TrackEntry element. @@ -27,15 +28,15 @@ class WebMVideoClient : public WebMParserClient { void Reset(); // Initialize |config| with the data in |codec_id|, |codec_private|, - // |is_encrypted| and the fields parsed from the last video track element this - // object was used to parse. + // |encryption_scheme| and the fields parsed from the last video track element + // this object was used to parse. // Returns true if |config| was successfully initialized. // Returns false if there was unexpected values in the provided parameters or // video track element fields. The contents of |config| are undefined in this // case and should not be relied upon. bool InitializeConfig(const std::string& codec_id, const std::vector<uint8_t>& codec_private, - bool is_encrypted, + const EncryptionScheme& encryption_scheme, VideoDecoderConfig* config); private: |