| 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();
|
|
|