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 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1339 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { | 1339 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
1340 DCHECK(!audio_configs_.empty()); | 1340 DCHECK(!audio_configs_.empty()); |
1341 DCHECK(video_configs_.empty()); | 1341 DCHECK(video_configs_.empty()); |
1342 DVLOG(3) << "UpdateAudioConfig."; | 1342 DVLOG(3) << "UpdateAudioConfig."; |
1343 | 1343 |
1344 if (audio_configs_[0].codec() != config.codec()) { | 1344 if (audio_configs_[0].codec() != config.codec()) { |
1345 MEDIA_LOG(log_cb_) << "Audio codec changes not allowed."; | 1345 MEDIA_LOG(log_cb_) << "Audio codec changes not allowed."; |
1346 return false; | 1346 return false; |
1347 } | 1347 } |
1348 | 1348 |
1349 if (audio_configs_[0].samples_per_second() != config.samples_per_second()) { | |
1350 MEDIA_LOG(log_cb_) << "Audio sample rate changes not allowed."; | |
1351 return false; | |
1352 } | |
1353 | |
1354 if (audio_configs_[0].channel_layout() != config.channel_layout()) { | |
1355 MEDIA_LOG(log_cb_) << "Audio channel layout changes not allowed."; | |
1356 return false; | |
1357 } | |
1358 | |
1359 if (audio_configs_[0].bits_per_channel() != config.bits_per_channel()) { | |
1360 MEDIA_LOG(log_cb_) << "Audio bits per channel changes not allowed."; | |
1361 return false; | |
1362 } | |
1363 | |
1364 if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { | 1349 if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { |
1365 MEDIA_LOG(log_cb_) << "Audio encryption changes not allowed."; | 1350 MEDIA_LOG(log_cb_) << "Audio encryption changes not allowed."; |
1366 return false; | 1351 return false; |
1367 } | 1352 } |
1368 | 1353 |
1369 // Check to see if the new config matches an existing one. | 1354 // Check to see if the new config matches an existing one. |
1370 for (size_t i = 0; i < audio_configs_.size(); ++i) { | 1355 for (size_t i = 0; i < audio_configs_.size(); ++i) { |
1371 if (config.Matches(audio_configs_[i])) { | 1356 if (config.Matches(audio_configs_[i])) { |
1372 append_config_index_ = i; | 1357 append_config_index_ = i; |
1373 return true; | 1358 return true; |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2181 if (buffer->end_of_stream() || buffer->timestamp() >= end) | 2166 if (buffer->end_of_stream() || buffer->timestamp() >= end) |
2182 break; | 2167 break; |
2183 if (buffer->timestamp() + buffer->duration() <= start) | 2168 if (buffer->timestamp() + buffer->duration() <= start) |
2184 continue; | 2169 continue; |
2185 buffers->push_back(buffer); | 2170 buffers->push_back(buffer); |
2186 } | 2171 } |
2187 return previous_size < buffers->size(); | 2172 return previous_size < buffers->size(); |
2188 } | 2173 } |
2189 | 2174 |
2190 } // namespace media | 2175 } // namespace media |
OLD | NEW |