Chromium Code Reviews| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 495 override_aec3_ = enable; | 495 override_aec3_ = enable; |
| 496 if (!has_echo_cancellation_) | 496 if (!has_echo_cancellation_) |
| 497 return; | 497 return; |
| 498 | 498 |
| 499 auto apm_config = audio_processing_->GetConfig(); | 499 auto apm_config = audio_processing_->GetConfig(); |
| 500 if (apm_config.echo_canceller3.enabled == enable) | 500 if (apm_config.echo_canceller3.enabled == enable) |
| 501 return; | 501 return; |
| 502 | 502 |
| 503 apm_config.echo_canceller3.enabled = enable; | 503 apm_config.echo_canceller3.enabled = enable; |
| 504 audio_processing_->ApplyConfig(apm_config); | 504 audio_processing_->ApplyConfig(apm_config); |
| 505 DCHECK(echo_information_); | 505 if (apm_config.echo_canceller3.enabled) { |
| 506 echo_information_.reset(new EchoInformation()); | 506 // Do not log any echo information when AEC3 is active, as the echo |
| 507 // information then will not be properly updated. | |
| 508 echo_information_.reset(); | |
| 509 } else { | |
| 510 echo_information_.reset(new EchoInformation()); | |
|
Guido Urdaneta
2017/06/09 01:39:33
prefer base::MakeUnique to raw new.
You can use as
peah
2017/06/09 11:04:06
Done.
| |
| 511 } | |
| 507 } | 512 } |
| 508 | 513 |
| 509 void MediaStreamAudioProcessor::OnIpcClosing() { | 514 void MediaStreamAudioProcessor::OnIpcClosing() { |
| 510 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 515 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| 511 aec_dump_message_filter_ = NULL; | 516 aec_dump_message_filter_ = NULL; |
| 512 } | 517 } |
| 513 | 518 |
| 514 // static | 519 // static |
| 515 bool MediaStreamAudioProcessor::WouldModifyAudio( | 520 bool MediaStreamAudioProcessor::WouldModifyAudio( |
| 516 const blink::WebMediaConstraints& constraints, | 521 const blink::WebMediaConstraints& constraints, |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 // Enable the audio processing components. | 694 // Enable the audio processing components. |
| 690 webrtc::AudioProcessing::Config apm_config; | 695 webrtc::AudioProcessing::Config apm_config; |
| 691 | 696 |
| 692 if (playout_data_source_) { | 697 if (playout_data_source_) { |
| 693 playout_data_source_->AddPlayoutSink(this); | 698 playout_data_source_->AddPlayoutSink(this); |
| 694 } | 699 } |
| 695 | 700 |
| 696 if (echo_cancellation) { | 701 if (echo_cancellation) { |
| 697 EnableEchoCancellation(audio_processing_.get()); | 702 EnableEchoCancellation(audio_processing_.get()); |
| 698 | 703 |
| 699 // Prepare for logging echo information. If there are data remaining in | |
| 700 // |echo_information_| we simply discard it. | |
| 701 echo_information_.reset(new EchoInformation()); | |
| 702 | |
| 703 apm_config.echo_canceller3.enabled = override_aec3_.value_or( | 704 apm_config.echo_canceller3.enabled = override_aec3_.value_or( |
| 704 base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3)); | 705 base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3)); |
| 706 | |
| 707 if (!apm_config.echo_canceller3.enabled) { | |
| 708 // Prepare for logging echo information. If there are data remaining in | |
| 709 // |echo_information_| we simply discard it. | |
| 710 echo_information_.reset(new EchoInformation()); | |
| 711 } else { | |
| 712 // Do not log any echo information when AEC3 is active, as the echo | |
| 713 // information then will not be properly updated. | |
| 714 echo_information_.reset(); | |
|
Guido Urdaneta
2017/06/09 01:39:33
ditto
peah
2017/06/09 11:04:06
Done.
| |
| 715 } | |
| 705 } else { | 716 } else { |
| 706 apm_config.echo_canceller3.enabled = false; | 717 apm_config.echo_canceller3.enabled = false; |
| 707 } | 718 } |
| 708 | 719 |
| 709 if (goog_ns) { | 720 if (goog_ns) { |
| 710 // The beamforming postfilter is effective at suppressing stationary noise, | 721 // The beamforming postfilter is effective at suppressing stationary noise, |
| 711 // so reduce the single-channel NS aggressiveness when enabled. | 722 // so reduce the single-channel NS aggressiveness when enabled. |
| 712 const NoiseSuppression::Level ns_level = | 723 const NoiseSuppression::Level ns_level = |
| 713 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow | 724 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow |
| 714 : NoiseSuppression::kHigh; | 725 : NoiseSuppression::kHigh; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 0 : agc->stream_analog_level(); | 902 0 : agc->stream_analog_level(); |
| 892 } | 903 } |
| 893 | 904 |
| 894 void MediaStreamAudioProcessor::UpdateAecStats() { | 905 void MediaStreamAudioProcessor::UpdateAecStats() { |
| 895 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 906 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| 896 if (echo_information_) | 907 if (echo_information_) |
| 897 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); | 908 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); |
| 898 } | 909 } |
| 899 | 910 |
| 900 } // namespace content | 911 } // namespace content |
| OLD | NEW |