Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: media/webm/webm_tracks_parser.cc

Issue 11088047: Support encrypted audio stream in demuxer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resolve comments and nits Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/webm/webm_tracks_parser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/webm/webm_tracks_parser.cc
diff --git a/media/webm/webm_tracks_parser.cc b/media/webm/webm_tracks_parser.cc
index bf039bf77bde53870e56cc3d0564cebde0c74762..a8721169d8788384038be6818273704562ba0b73 100644
--- a/media/webm/webm_tracks_parser.cc
+++ b/media/webm/webm_tracks_parser.cc
@@ -25,15 +25,6 @@ WebMTracksParser::WebMTracksParser()
WebMTracksParser::~WebMTracksParser() {}
-const std::string& WebMTracksParser::video_encryption_key_id() const {
- if (!video_content_encodings_client_.get())
- return EmptyString();
-
- DCHECK(!video_content_encodings_client_->content_encodings().empty());
- return video_content_encodings_client_->content_encodings()[0]->
- encryption_key_id();
-}
-
int WebMTracksParser::Parse(const uint8* buf, int size) {
track_type_ =-1;
track_num_ = -1;
@@ -50,7 +41,6 @@ int WebMTracksParser::Parse(const uint8* buf, int size) {
return parser.IsParsingComplete() ? result : 0;
}
-
WebMParserClient* WebMTracksParser::OnListStart(int id) {
if (id == kWebMIdContentEncodings) {
DCHECK(!track_content_encodings_client_.get());
@@ -81,23 +71,33 @@ bool WebMTracksParser::OnListEnd(int id) {
return false;
}
- if (track_type_ == kWebMTrackTypeVideo) {
- video_track_num_ = track_num_;
- if (track_content_encodings_client_.get()) {
- video_content_encodings_client_ =
- track_content_encodings_client_.Pass();
- }
- } else if (track_type_ == kWebMTrackTypeAudio) {
- audio_track_num_ = track_num_;
- if (track_content_encodings_client_.get()) {
- audio_content_encodings_client_ =
- track_content_encodings_client_.Pass();
- }
- } else {
+ if (track_type_ != kWebMTrackTypeAudio &&
+ track_type_ != kWebMTrackTypeVideo) {
DVLOG(1) << "Unexpected TrackType " << track_type_;
return false;
}
+ // WebM file should have at most one ContentEncoding element, whose
+ // encoding type must be "encryption".
+ // See: http://wiki.webmproject.org/encryption/webm-encryption-rfc
+ std::string encryption_key_id;
+ if (track_content_encodings_client_.get()) {
+ DCHECK_EQ(track_content_encodings_client_->content_encodings().size(),
+ 1u);
acolwell GONE FROM CHROMIUM 2012/10/11 16:50:33 This will cause files w/ multiple content encoding
+ const ContentEncoding* content_encoding =
+ track_content_encodings_client_->content_encodings()[0];
+ DCHECK_EQ(content_encoding->type(), ContentEncoding::kTypeEncryption);
+ encryption_key_id = content_encoding->encryption_key_id();
+ }
+
+ if (track_type_ == kWebMTrackTypeAudio) {
+ audio_track_num_ = track_num_;
+ audio_encryption_key_id_ = encryption_key_id;
+ } else if (track_type_ == kWebMTrackTypeVideo) {
+ video_track_num_ = track_num_;
+ video_encryption_key_id_ = encryption_key_id;
+ }
+
track_type_ = -1;
track_num_ = -1;
track_content_encodings_client_.reset();
« no previous file with comments | « media/webm/webm_tracks_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698