OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" | 11 #include "webrtc/modules/audio_processing/audio_processing_impl.h" |
12 | 12 |
| 13 #include <math.h> |
13 #include <algorithm> | 14 #include <algorithm> |
14 | 15 |
15 #include "webrtc/base/checks.h" | 16 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
17 #include "webrtc/base/platform_file.h" | 18 #include "webrtc/base/platform_file.h" |
18 #include "webrtc/base/trace_event.h" | 19 #include "webrtc/base/trace_event.h" |
19 #include "webrtc/common_audio/audio_converter.h" | 20 #include "webrtc/common_audio/audio_converter.h" |
20 #include "webrtc/common_audio/channel_buffer.h" | 21 #include "webrtc/common_audio/channel_buffer.h" |
21 #include "webrtc/common_audio/include/audio_util.h" | 22 #include "webrtc/common_audio/include/audio_util.h" |
22 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 23 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 RmsLevel::Levels levels = capture_input_rms_.AverageAndPeak(); | 1141 RmsLevel::Levels levels = capture_input_rms_.AverageAndPeak(); |
1141 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelAverageRms", | 1142 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelAverageRms", |
1142 levels.average, 1, RmsLevel::kMinLevelDb, 64); | 1143 levels.average, 1, RmsLevel::kMinLevelDb, 64); |
1143 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelPeakRms", | 1144 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelPeakRms", |
1144 levels.peak, 1, RmsLevel::kMinLevelDb, 64); | 1145 levels.peak, 1, RmsLevel::kMinLevelDb, 64); |
1145 } | 1146 } |
1146 | 1147 |
1147 if (private_submodules_->echo_canceller3) { | 1148 if (private_submodules_->echo_canceller3) { |
1148 const int new_agc_level = gain_control()->stream_analog_level(); | 1149 const int new_agc_level = gain_control()->stream_analog_level(); |
1149 capture_.echo_path_gain_change = | 1150 capture_.echo_path_gain_change = |
1150 (capture_.previous_agc_level != new_agc_level); | 1151 abs(capture_.previous_agc_level - new_agc_level) > 5; |
1151 capture_.previous_agc_level = new_agc_level; | 1152 capture_.previous_agc_level = new_agc_level; |
1152 private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer); | 1153 private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer); |
1153 } | 1154 } |
1154 | 1155 |
1155 if (constants_.use_experimental_agc && | 1156 if (constants_.use_experimental_agc && |
1156 public_submodules_->gain_control->is_enabled()) { | 1157 public_submodules_->gain_control->is_enabled()) { |
1157 private_submodules_->agc_manager->AnalyzePreProcess( | 1158 private_submodules_->agc_manager->AnalyzePreProcess( |
1158 capture_buffer->channels()[0], capture_buffer->num_channels(), | 1159 capture_buffer->channels()[0], capture_buffer->num_channels(), |
1159 capture_nonlocked_.capture_processing_format.num_frames()); | 1160 capture_nonlocked_.capture_processing_format.num_frames()); |
1160 } | 1161 } |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 previous_agc_level(0), | 2003 previous_agc_level(0), |
2003 echo_path_gain_change(false) {} | 2004 echo_path_gain_change(false) {} |
2004 | 2005 |
2005 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 2006 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
2006 | 2007 |
2007 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 2008 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
2008 | 2009 |
2009 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 2010 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
2010 | 2011 |
2011 } // namespace webrtc | 2012 } // namespace webrtc |
OLD | NEW |