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/renderers/audio_renderer_impl.h" | 5 #include "media/renderers/audio_renderer_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); | 485 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED); |
486 return; | 486 return; |
487 } | 487 } |
488 | 488 |
489 if (expecting_config_changes_) | 489 if (expecting_config_changes_) |
490 buffer_converter_.reset(new AudioBufferConverter(audio_parameters_)); | 490 buffer_converter_.reset(new AudioBufferConverter(audio_parameters_)); |
491 | 491 |
492 // We're all good! Continue initializing the rest of the audio renderer | 492 // We're all good! Continue initializing the rest of the audio renderer |
493 // based on the decoder format. | 493 // based on the decoder format. |
494 algorithm_.reset(new AudioRendererAlgorithm()); | 494 algorithm_.reset(new AudioRendererAlgorithm()); |
495 algorithm_->Initialize(audio_parameters_); | 495 algorithm_->Initialize(audio_parameters_, encrypted_); |
496 ConfigureChannelMask(); | 496 ConfigureChannelMask(); |
497 | 497 |
498 ChangeState_Locked(kFlushed); | 498 ChangeState_Locked(kFlushed); |
499 | 499 |
500 { | 500 { |
501 base::AutoUnlock auto_unlock(lock_); | 501 base::AutoUnlock auto_unlock(lock_); |
502 sink_->Initialize(audio_parameters_, this); | 502 sink_->Initialize(audio_parameters_, this); |
503 sink_->Start(); | 503 sink_->Start(); |
504 | 504 |
505 // Some sinks play on start... | 505 // Some sinks play on start... |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 // All channels with a zero mix are muted and can be ignored. | 1009 // All channels with a zero mix are muted and can be ignored. |
1010 std::vector<bool> channel_mask(audio_parameters_.channels(), false); | 1010 std::vector<bool> channel_mask(audio_parameters_.channels(), false); |
1011 for (size_t ch = 0; ch < matrix.size(); ++ch) { | 1011 for (size_t ch = 0; ch < matrix.size(); ++ch) { |
1012 channel_mask[ch] = std::any_of(matrix[ch].begin(), matrix[ch].end(), | 1012 channel_mask[ch] = std::any_of(matrix[ch].begin(), matrix[ch].end(), |
1013 [](float mix) { return !!mix; }); | 1013 [](float mix) { return !!mix; }); |
1014 } | 1014 } |
1015 algorithm_->SetChannelMask(std::move(channel_mask)); | 1015 algorithm_->SetChannelMask(std::move(channel_mask)); |
1016 } | 1016 } |
1017 | 1017 |
1018 } // namespace media | 1018 } // namespace media |
OLD | NEW |