OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/media_stream_audio_processor.h" | 5 #include "content/renderer/media/media_stream_audio_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 clipping_level_min.value_or(webrtc::kClippedLevelMin))); | 660 clipping_level_min.value_or(webrtc::kClippedLevelMin))); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 // Create and configure the webrtc::AudioProcessing. | 664 // Create and configure the webrtc::AudioProcessing. |
665 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); | 665 audio_processing_.reset(webrtc::AudioProcessing::Create(config)); |
666 | 666 |
667 // Enable the audio processing components. | 667 // Enable the audio processing components. |
668 webrtc::AudioProcessing::Config apm_config; | 668 webrtc::AudioProcessing::Config apm_config; |
669 | 669 |
| 670 if (playout_data_source_) { |
| 671 playout_data_source_->AddPlayoutSink(this); |
| 672 } |
| 673 |
670 if (echo_cancellation) { | 674 if (echo_cancellation) { |
671 EnableEchoCancellation(audio_processing_.get()); | 675 EnableEchoCancellation(audio_processing_.get()); |
672 | 676 |
673 if (playout_data_source_) | |
674 playout_data_source_->AddPlayoutSink(this); | |
675 | |
676 // Prepare for logging echo information. If there are data remaining in | 677 // Prepare for logging echo information. If there are data remaining in |
677 // |echo_information_| we simply discard it. | 678 // |echo_information_| we simply discard it. |
678 echo_information_.reset(new EchoInformation()); | 679 echo_information_.reset(new EchoInformation()); |
679 } | 680 } |
680 | 681 |
681 if (goog_ns) { | 682 if (goog_ns) { |
682 // The beamforming postfilter is effective at suppressing stationary noise, | 683 // The beamforming postfilter is effective at suppressing stationary noise, |
683 // so reduce the single-channel NS aggressiveness when enabled. | 684 // so reduce the single-channel NS aggressiveness when enabled. |
684 const NoiseSuppression::Level ns_level = | 685 const NoiseSuppression::Level ns_level = |
685 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow | 686 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 0 : agc->stream_analog_level(); | 864 0 : agc->stream_analog_level(); |
864 } | 865 } |
865 | 866 |
866 void MediaStreamAudioProcessor::UpdateAecStats() { | 867 void MediaStreamAudioProcessor::UpdateAecStats() { |
867 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 868 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
868 if (echo_information_) | 869 if (echo_information_) |
869 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); | 870 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); |
870 } | 871 } |
871 | 872 |
872 } // namespace content | 873 } // namespace content |
OLD | NEW |