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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/feature_list.h" | 12 #include "base/feature_list.h" |
13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
15 #include "base/optional.h" | 15 #include "base/optional.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "content/public/common/content_features.h" |
21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
22 #include "content/renderer/media/media_stream_audio_processor_options.h" | 23 #include "content/renderer/media/media_stream_audio_processor_options.h" |
23 #include "content/renderer/media/webrtc_audio_device_impl.h" | 24 #include "content/renderer/media/webrtc_audio_device_impl.h" |
24 #include "media/base/audio_converter.h" | 25 #include "media/base/audio_converter.h" |
25 #include "media/base/audio_fifo.h" | 26 #include "media/base/audio_fifo.h" |
26 #include "media/base/audio_parameters.h" | 27 #include "media/base/audio_parameters.h" |
27 #include "media/base/channel_layout.h" | 28 #include "media/base/channel_layout.h" |
28 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 29 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
29 #include "third_party/webrtc/api/mediaconstraintsinterface.h" | 30 #include "third_party/webrtc/api/mediaconstraintsinterface.h" |
30 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" | 31 #include "third_party/webrtc/modules/audio_processing/typing_detection.h" |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 670 |
670 if (echo_cancellation) { | 671 if (echo_cancellation) { |
671 EnableEchoCancellation(audio_processing_.get()); | 672 EnableEchoCancellation(audio_processing_.get()); |
672 | 673 |
673 if (playout_data_source_) | 674 if (playout_data_source_) |
674 playout_data_source_->AddPlayoutSink(this); | 675 playout_data_source_->AddPlayoutSink(this); |
675 | 676 |
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()); |
| 680 |
| 681 apm_config.echo_canceller3.enabled = |
| 682 base::FeatureList::IsEnabled(features::kWebRtcUseEchoCanceller3); |
| 683 } else { |
| 684 apm_config.echo_canceller3.enabled = false; |
679 } | 685 } |
680 | 686 |
681 if (goog_ns) { | 687 if (goog_ns) { |
682 // The beamforming postfilter is effective at suppressing stationary noise, | 688 // The beamforming postfilter is effective at suppressing stationary noise, |
683 // so reduce the single-channel NS aggressiveness when enabled. | 689 // so reduce the single-channel NS aggressiveness when enabled. |
684 const NoiseSuppression::Level ns_level = | 690 const NoiseSuppression::Level ns_level = |
685 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow | 691 config.Get<webrtc::Beamforming>().enabled ? NoiseSuppression::kLow |
686 : NoiseSuppression::kHigh; | 692 : NoiseSuppression::kHigh; |
687 | 693 |
688 EnableNoiseSuppression(audio_processing_.get(), ns_level); | 694 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(); | 869 0 : agc->stream_analog_level(); |
864 } | 870 } |
865 | 871 |
866 void MediaStreamAudioProcessor::UpdateAecStats() { | 872 void MediaStreamAudioProcessor::UpdateAecStats() { |
867 DCHECK(main_thread_runner_->BelongsToCurrentThread()); | 873 DCHECK(main_thread_runner_->BelongsToCurrentThread()); |
868 if (echo_information_) | 874 if (echo_information_) |
869 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); | 875 echo_information_->UpdateAecStats(audio_processing_->echo_cancellation()); |
870 } | 876 } |
871 | 877 |
872 } // namespace content | 878 } // namespace content |
OLD | NEW |