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

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: rebase 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..7232285486725cd5f029788e25b2ae42438c1d52 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,29 @@ 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;
}
+ std::string encryption_key_id;
+ if (track_content_encodings_client_.get()) {
+ DCHECK(!track_content_encodings_client_->content_encodings().empty());
+ // If we have multiple ContentEncoding in one track. Always choose the
+ // key id in the first ContentEncoding as the key id of the track.
+ encryption_key_id = track_content_encodings_client_->
+ content_encodings()[0]->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