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 |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 if (log_rms) { | 1138 if (log_rms) { |
1139 capture_rms_interval_counter_ = 0; | 1139 capture_rms_interval_counter_ = 0; |
1140 RmsLevel::Levels levels = capture_input_rms_.AverageAndPeak(); | 1140 RmsLevel::Levels levels = capture_input_rms_.AverageAndPeak(); |
1141 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelAverageRms", | 1141 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelAverageRms", |
1142 levels.average, 1, RmsLevel::kMinLevelDb, 64); | 1142 levels.average, 1, RmsLevel::kMinLevelDb, 64); |
1143 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelPeakRms", | 1143 RTC_HISTOGRAM_COUNTS_LINEAR("WebRTC.Audio.ApmCaptureInputLevelPeakRms", |
1144 levels.peak, 1, RmsLevel::kMinLevelDb, 64); | 1144 levels.peak, 1, RmsLevel::kMinLevelDb, 64); |
1145 } | 1145 } |
1146 | 1146 |
1147 if (private_submodules_->echo_canceller3) { | 1147 if (private_submodules_->echo_canceller3) { |
| 1148 const int new_agc_level = gain_control()->stream_analog_level(); |
| 1149 capture_.echo_path_gain_change = |
| 1150 (capture_.previous_agc_level != new_agc_level); |
| 1151 capture_.previous_agc_level = new_agc_level; |
1148 private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer); | 1152 private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer); |
1149 } | 1153 } |
1150 | 1154 |
1151 if (constants_.use_experimental_agc && | 1155 if (constants_.use_experimental_agc && |
1152 public_submodules_->gain_control->is_enabled()) { | 1156 public_submodules_->gain_control->is_enabled()) { |
1153 private_submodules_->agc_manager->AnalyzePreProcess( | 1157 private_submodules_->agc_manager->AnalyzePreProcess( |
1154 capture_buffer->channels()[0], capture_buffer->num_channels(), | 1158 capture_buffer->channels()[0], capture_buffer->num_channels(), |
1155 capture_nonlocked_.capture_processing_format.num_frames()); | 1159 capture_nonlocked_.capture_processing_format.num_frames()); |
1156 } | 1160 } |
1157 | 1161 |
(...skipping 28 matching lines...) Expand all Loading... |
1186 public_submodules_->noise_suppression->AnalyzeCaptureAudio(capture_buffer); | 1190 public_submodules_->noise_suppression->AnalyzeCaptureAudio(capture_buffer); |
1187 | 1191 |
1188 // Ensure that the stream delay was set before the call to the | 1192 // Ensure that the stream delay was set before the call to the |
1189 // AEC ProcessCaptureAudio function. | 1193 // AEC ProcessCaptureAudio function. |
1190 if (public_submodules_->echo_cancellation->is_enabled() && | 1194 if (public_submodules_->echo_cancellation->is_enabled() && |
1191 !was_stream_delay_set()) { | 1195 !was_stream_delay_set()) { |
1192 return AudioProcessing::kStreamParameterNotSetError; | 1196 return AudioProcessing::kStreamParameterNotSetError; |
1193 } | 1197 } |
1194 | 1198 |
1195 if (private_submodules_->echo_canceller3) { | 1199 if (private_submodules_->echo_canceller3) { |
1196 private_submodules_->echo_canceller3->ProcessCapture(capture_buffer, false); | 1200 private_submodules_->echo_canceller3->ProcessCapture( |
| 1201 capture_buffer, capture_.echo_path_gain_change); |
1197 } else { | 1202 } else { |
1198 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio( | 1203 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio( |
1199 capture_buffer, stream_delay_ms())); | 1204 capture_buffer, stream_delay_ms())); |
1200 } | 1205 } |
1201 | 1206 |
1202 if (public_submodules_->echo_control_mobile->is_enabled() && | 1207 if (public_submodules_->echo_control_mobile->is_enabled() && |
1203 public_submodules_->noise_suppression->is_enabled()) { | 1208 public_submodules_->noise_suppression->is_enabled()) { |
1204 capture_buffer->CopyLowPassToReference(); | 1209 capture_buffer->CopyLowPassToReference(); |
1205 } | 1210 } |
1206 public_submodules_->noise_suppression->ProcessCaptureAudio(capture_buffer); | 1211 public_submodules_->noise_suppression->ProcessCaptureAudio(capture_buffer); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1986 was_stream_delay_set(false), | 1991 was_stream_delay_set(false), |
1987 last_stream_delay_ms(0), | 1992 last_stream_delay_ms(0), |
1988 last_aec_system_delay_ms(0), | 1993 last_aec_system_delay_ms(0), |
1989 stream_delay_jumps(-1), | 1994 stream_delay_jumps(-1), |
1990 output_will_be_muted(false), | 1995 output_will_be_muted(false), |
1991 key_pressed(false), | 1996 key_pressed(false), |
1992 transient_suppressor_enabled(transient_suppressor_enabled), | 1997 transient_suppressor_enabled(transient_suppressor_enabled), |
1993 array_geometry(array_geometry), | 1998 array_geometry(array_geometry), |
1994 target_direction(target_direction), | 1999 target_direction(target_direction), |
1995 capture_processing_format(kSampleRate16kHz), | 2000 capture_processing_format(kSampleRate16kHz), |
1996 split_rate(kSampleRate16kHz) {} | 2001 split_rate(kSampleRate16kHz), |
| 2002 previous_agc_level(0), |
| 2003 echo_path_gain_change(false) {} |
1997 | 2004 |
1998 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 2005 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1999 | 2006 |
2000 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 2007 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
2001 | 2008 |
2002 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 2009 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
2003 | 2010 |
2004 } // namespace webrtc | 2011 } // namespace webrtc |
OLD | NEW |