OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/filters/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 audio_configs_.resize(audio_configs_.size() + 1); | 933 audio_configs_.resize(audio_configs_.size() + 1); |
934 audio_configs_[append_config_index_] = new AudioDecoderConfig(); | 934 audio_configs_[append_config_index_] = new AudioDecoderConfig(); |
935 audio_configs_[append_config_index_]->CopyFrom(config); | 935 audio_configs_[append_config_index_]->CopyFrom(config); |
936 return true; | 936 return true; |
937 } | 937 } |
938 | 938 |
939 bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) { | 939 bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) { |
940 DCHECK(!video_configs_.empty()); | 940 DCHECK(!video_configs_.empty()); |
941 DCHECK(audio_configs_.empty()); | 941 DCHECK(audio_configs_.empty()); |
942 | 942 |
| 943 if (video_configs_[0]->is_encrypted() != config.is_encrypted()) { |
| 944 DVLOG(1) << "UpdateVideoConfig() : Encryption changes not allowed."; |
| 945 return false; |
| 946 } |
| 947 |
943 if (video_configs_[0]->codec() != config.codec()) { | 948 if (video_configs_[0]->codec() != config.codec()) { |
944 DVLOG(1) << "UpdateVideoConfig() : Codec changes not allowed."; | 949 DVLOG(1) << "UpdateVideoConfig() : Codec changes not allowed."; |
945 return false; | 950 return false; |
946 } | 951 } |
947 | 952 |
948 // Check to see if the new config matches an existing one. | 953 // Check to see if the new config matches an existing one. |
949 for (size_t i = 0; i < video_configs_.size(); ++i) { | 954 for (size_t i = 0; i < video_configs_.size(); ++i) { |
950 if (config.Matches(*video_configs_[i])) { | 955 if (config.Matches(*video_configs_[i])) { |
951 append_config_index_ = i; | 956 append_config_index_ = i; |
952 return true; | 957 return true; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 return 2 * GetApproximateDuration(); | 1420 return 2 * GetApproximateDuration(); |
1416 } | 1421 } |
1417 | 1422 |
1418 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1423 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1419 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1424 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1420 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1425 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1421 return max_interbuffer_distance; | 1426 return max_interbuffer_distance; |
1422 } | 1427 } |
1423 | 1428 |
1424 } // namespace media | 1429 } // namespace media |
OLD | NEW |