| 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 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { | 1469 bool SourceBufferStream::UpdateAudioConfig(const AudioDecoderConfig& config) { |
| 1470 DCHECK(!audio_configs_.empty()); | 1470 DCHECK(!audio_configs_.empty()); |
| 1471 DCHECK(video_configs_.empty()); | 1471 DCHECK(video_configs_.empty()); |
| 1472 DVLOG(3) << "UpdateAudioConfig."; | 1472 DVLOG(3) << "UpdateAudioConfig."; |
| 1473 | 1473 |
| 1474 if (audio_configs_[0].codec() != config.codec()) { | 1474 if (audio_configs_[0].codec() != config.codec()) { |
| 1475 MEDIA_LOG(ERROR, media_log_) << "Audio codec changes not allowed."; | 1475 MEDIA_LOG(ERROR, media_log_) << "Audio codec changes not allowed."; |
| 1476 return false; | 1476 return false; |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 if (audio_configs_[0].is_encrypted() != config.is_encrypted()) { | 1479 if (!audio_configs_[0].encryption_scheme().Matches( |
| 1480 config.encryption_scheme())) { |
| 1480 MEDIA_LOG(ERROR, media_log_) << "Audio encryption changes not allowed."; | 1481 MEDIA_LOG(ERROR, media_log_) << "Audio encryption changes not allowed."; |
| 1481 return false; | 1482 return false; |
| 1482 } | 1483 } |
| 1483 | 1484 |
| 1484 // Check to see if the new config matches an existing one. | 1485 // Check to see if the new config matches an existing one. |
| 1485 for (size_t i = 0; i < audio_configs_.size(); ++i) { | 1486 for (size_t i = 0; i < audio_configs_.size(); ++i) { |
| 1486 if (config.Matches(audio_configs_[i])) { | 1487 if (config.Matches(audio_configs_[i])) { |
| 1487 append_config_index_ = i; | 1488 append_config_index_ = i; |
| 1488 return true; | 1489 return true; |
| 1489 } | 1490 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1500 bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) { | 1501 bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) { |
| 1501 DCHECK(!video_configs_.empty()); | 1502 DCHECK(!video_configs_.empty()); |
| 1502 DCHECK(audio_configs_.empty()); | 1503 DCHECK(audio_configs_.empty()); |
| 1503 DVLOG(3) << "UpdateVideoConfig."; | 1504 DVLOG(3) << "UpdateVideoConfig."; |
| 1504 | 1505 |
| 1505 if (video_configs_[0].codec() != config.codec()) { | 1506 if (video_configs_[0].codec() != config.codec()) { |
| 1506 MEDIA_LOG(ERROR, media_log_) << "Video codec changes not allowed."; | 1507 MEDIA_LOG(ERROR, media_log_) << "Video codec changes not allowed."; |
| 1507 return false; | 1508 return false; |
| 1508 } | 1509 } |
| 1509 | 1510 |
| 1510 if (video_configs_[0].is_encrypted() != config.is_encrypted()) { | 1511 if (!video_configs_[0].encryption_scheme().Matches( |
| 1512 config.encryption_scheme())) { |
| 1511 MEDIA_LOG(ERROR, media_log_) << "Video encryption changes not allowed."; | 1513 MEDIA_LOG(ERROR, media_log_) << "Video encryption changes not allowed."; |
| 1512 return false; | 1514 return false; |
| 1513 } | 1515 } |
| 1514 | 1516 |
| 1515 // Check to see if the new config matches an existing one. | 1517 // Check to see if the new config matches an existing one. |
| 1516 for (size_t i = 0; i < video_configs_.size(); ++i) { | 1518 for (size_t i = 0; i < video_configs_.size(); ++i) { |
| 1517 if (config.Matches(video_configs_[i])) { | 1519 if (config.Matches(video_configs_[i])) { |
| 1518 append_config_index_ = i; | 1520 append_config_index_ = i; |
| 1519 return true; | 1521 return true; |
| 1520 } | 1522 } |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 return false; | 1839 return false; |
| 1838 | 1840 |
| 1839 DCHECK_NE(have_splice_buffers, have_preroll_buffer); | 1841 DCHECK_NE(have_splice_buffers, have_preroll_buffer); |
| 1840 splice_buffers_index_ = 0; | 1842 splice_buffers_index_ = 0; |
| 1841 pending_buffer_.swap(*out_buffer); | 1843 pending_buffer_.swap(*out_buffer); |
| 1842 pending_buffers_complete_ = false; | 1844 pending_buffers_complete_ = false; |
| 1843 return true; | 1845 return true; |
| 1844 } | 1846 } |
| 1845 | 1847 |
| 1846 } // namespace media | 1848 } // namespace media |
| OLD | NEW |