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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 DCHECK(render_thread_checker_.CalledOnValidThread()); | 573 DCHECK(render_thread_checker_.CalledOnValidThread()); |
| 574 render_fifo_->ReattachThreadChecker(); | 574 render_fifo_->ReattachThreadChecker(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { | 577 void MediaStreamAudioProcessor::GetStats(AudioProcessorStats* stats) { |
| 578 stats->typing_noise_detected = | 578 stats->typing_noise_detected = |
| 579 (base::subtle::Acquire_Load(&typing_detected_) != false); | 579 (base::subtle::Acquire_Load(&typing_detected_) != false); |
| 580 GetAudioProcessingStats(audio_processing_.get(), stats); | 580 GetAudioProcessingStats(audio_processing_.get(), stats); |
| 581 } | 581 } |
| 582 | 582 |
| 583 // Features for http://crbug.com/688388. This value is sent to WebRTC's echo | |
|
hlundin-chromium
2017/02/09 10:20:45
Move this information to content_features.{h|cc}.
peah
2017/02/15 13:24:24
Done.
| |
| 584 // canceller to toggle which echo canceller should be used. | |
| 585 const base::Feature kUseEchoCanceller3{"UseEchoCanceller3", | |
|
hlundin-chromium
2017/02/09 10:20:45
You are defining this feature twice: here and in c
peah
2017/02/15 13:24:24
Thanks! Great suggestion!
Done.
| |
| 586 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 587 | |
| 583 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( | 588 void MediaStreamAudioProcessor::InitializeAudioProcessingModule( |
| 584 const blink::WebMediaConstraints& constraints, | 589 const blink::WebMediaConstraints& constraints, |
| 585 const MediaStreamDevice::AudioDeviceParameters& input_params) { | 590 const MediaStreamDevice::AudioDeviceParameters& input_params) { |
| 586 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 591 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| 587 DCHECK(!audio_processing_); | 592 DCHECK(!audio_processing_); |
| 588 | 593 |
| 589 MediaAudioConstraints audio_constraints(constraints, input_params.effects); | 594 MediaAudioConstraints audio_constraints(constraints, input_params.effects); |
| 590 | 595 |
| 591 // Note: The audio mirroring constraint (i.e., swap left and right channels) | 596 // Note: The audio mirroring constraint (i.e., swap left and right channels) |
| 592 // is handled within this MediaStreamAudioProcessor and does not, by itself, | 597 // is handled within this MediaStreamAudioProcessor and does not, by itself, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 | 674 |
| 670 if (echo_cancellation) { | 675 if (echo_cancellation) { |
| 671 EnableEchoCancellation(audio_processing_.get()); | 676 EnableEchoCancellation(audio_processing_.get()); |
| 672 | 677 |
| 673 if (playout_data_source_) | 678 if (playout_data_source_) |
| 674 playout_data_source_->AddPlayoutSink(this); | 679 playout_data_source_->AddPlayoutSink(this); |
| 675 | 680 |
| 676 // Prepare for logging echo information. If there are data remaining in | 681 // Prepare for logging echo information. If there are data remaining in |
| 677 // |echo_information_| we simply discard it. | 682 // |echo_information_| we simply discard it. |
| 678 echo_information_.reset(new EchoInformation()); | 683 echo_information_.reset(new EchoInformation()); |
| 684 | |
| 685 apm_config.echo_canceller3.enabled = | |
| 686 base::FeatureList::IsEnabled(kUseEchoCanceller3); | |
| 687 } else { | |
| 688 apm_config.echo_canceller3.enabled = false; | |
| 679 } | 689 } |
| 680 | 690 |
| 681 if (goog_ns) { | 691 if (goog_ns) { |
| 682 // The beamforming postfilter is effective at suppressing stationary noise, | 692 // The beamforming postfilter is effective at suppressing stationary noise, |
| 683 // so reduce the single-channel NS aggressiveness when enabled. | 693 // so reduce the single-channel NS aggressiveness when enabled. |
| 684 const NoiseSuppression::Level ns_level = | 694 const NoiseSuppression::Level ns_level = |
| 685 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow | 695 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow |
| 686 : NoiseSuppression::kHigh; | 696 : NoiseSuppression::kHigh; |
| 687 | 697 |
| 688 EnableNoiseSuppression(audio_processing_.get(), ns_level); | 698 EnableNoiseSuppression(audio_processing_.get(), ns_level); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 0 : agc->stream_analog_level(); | 873 0 : agc->stream_analog_level(); |
| 864 } | 874 } |
| 865 | 875 |
| 866 void MediaStreamAudioProcessor::UpdateAecStats() { | 876 void MediaStreamAudioProcessor::UpdateAecStats() { |
| 867 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 877 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
| 868 if (echo_information_) | 878 if (echo_information_) |
| 869 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); | 879 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); |
| 870 } | 880 } |
| 871 | 881 |
| 872 } // namespace content | 882 } // namespace content |
| OLD | NEW |