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