| 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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { | 1345 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
| 1346 DCHECK(!audio_configs_.empty()); | 1346 DCHECK(!audio_configs_.empty()); |
| 1347 DCHECK(video_configs_.empty()); | 1347 DCHECK(video_configs_.empty()); |
| 1348 DVLOG(3) << "UpdateAudioConfig."; | 1348 DVLOG(3) << "UpdateAudioConfig."; |
| 1349 | 1349 |
| 1350 if (audio_configs_[0].codec() != config.codec()) { | 1350 if (audio_configs_[0].codec() != config.codec()) { |
| 1351 MEDIA_LOG(log_cb_) << "Audio codec changes not allowed."; | 1351 MEDIA_LOG(log_cb_) << "Audio codec changes not allowed."; |
| 1352 return false; | 1352 return false; |
| 1353 } | 1353 } |
| 1354 | 1354 |
| 1355 if (audio_configs_[0].samples_per_second() != config.samples_per_second()) { | |
| 1356 MEDIA_LOG(log_cb_) << "Audio sample rate changes not allowed."; | |
| 1357 return false; | |
| 1358 } | |
| 1359 | |
| 1360 if (audio_configs_[0].channel_layout() != config.channel_layout()) { | |
| 1361 MEDIA_LOG(log_cb_) << "Audio channel layout changes not allowed."; | |
| 1362 return false; | |
| 1363 } | |
| 1364 | |
| 1365 if (audio_configs_[0].bits_per_channel() != config.bits_per_channel()) { | |
| 1366 MEDIA_LOG(log_cb_) << "Audio bits per channel changes not allowed."; | |
| 1367 return false; | |
| 1368 } | |
| 1369 | |
| 1370 if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { | 1355 if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { |
| 1371 MEDIA_LOG(log_cb_) << "Audio encryption changes not allowed."; | 1356 MEDIA_LOG(log_cb_) << "Audio encryption changes not allowed."; |
| 1372 return false; | 1357 return false; |
| 1373 } | 1358 } |
| 1374 | 1359 |
| 1375 // Check to see if the new config matches an existing one. | 1360 // Check to see if the new config matches an existing one. |
| 1376 for (size_t i = 0; i < audio_configs_.size(); ++i) { | 1361 for (size_t i = 0; i < audio_configs_.size(); ++i) { |
| 1377 if (config.Matches(audio_configs_[i])) { | 1362 if (config.Matches(audio_configs_[i])) { |
| 1378 append_config_index_ = i; | 1363 append_config_index_ = i; |
| 1379 return true; | 1364 return true; |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2187 if (buffer->end_of_stream() || buffer->timestamp() >= end) | 2172 if (buffer->end_of_stream() || buffer->timestamp() >= end) |
| 2188 break; | 2173 break; |
| 2189 if (buffer->timestamp() + buffer->duration() <= start) | 2174 if (buffer->timestamp() + buffer->duration() <= start) |
| 2190 continue; | 2175 continue; |
| 2191 buffers->push_back(buffer); | 2176 buffers->push_back(buffer); |
| 2192 } | 2177 } |
| 2193 return previous_size < buffers->size(); | 2178 return previous_size < buffers->size(); |
| 2194 } | 2179 } |
| 2195 | 2180 |
| 2196 } // namespace media | 2181 } // namespace media |
| OLD | NEW |