Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1312)

Side by Side Diff: webrtc/modules/audio_processing/echo_cancellation_impl.cc

Issue 1404743003: Removed the indirect error message reporting in aec and aecm. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@process_test_no_output_CL
Patch Set: Merge from latest master Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 size_t handle_index = 0; 87 size_t handle_index = 0;
88 for (int i = 0; i < apm_->num_output_channels(); i++) { 88 for (int i = 0; i < apm_->num_output_channels(); i++) {
89 for (int j = 0; j < audio->num_channels(); j++) { 89 for (int j = 0; j < audio->num_channels(); j++) {
90 Handle* my_handle = static_cast<Handle*>(handle(handle_index)); 90 Handle* my_handle = static_cast<Handle*>(handle(handle_index));
91 err = WebRtcAec_BufferFarend( 91 err = WebRtcAec_BufferFarend(
92 my_handle, 92 my_handle,
93 audio->split_bands_const_f(j)[kBand0To8kHz], 93 audio->split_bands_const_f(j)[kBand0To8kHz],
94 audio->num_frames_per_band()); 94 audio->num_frames_per_band());
95 95
96 if (err != apm_->kNoError) { 96 if (err != apm_->kNoError) {
97 return GetHandleError(my_handle); // TODO(ajm): warning possible? 97 return MapError(err); // TODO(ajm): warning possible?
98 } 98 }
99 99
100 handle_index++; 100 handle_index++;
101 } 101 }
102 } 102 }
103 103
104 return apm_->kNoError; 104 return apm_->kNoError;
105 } 105 }
106 106
107 int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio) { 107 int EchoCancellationImpl::ProcessCaptureAudio(AudioBuffer* audio) {
(...skipping 23 matching lines...) Expand all
131 err = WebRtcAec_Process( 131 err = WebRtcAec_Process(
132 my_handle, 132 my_handle,
133 audio->split_bands_const_f(i), 133 audio->split_bands_const_f(i),
134 audio->num_bands(), 134 audio->num_bands(),
135 audio->split_bands_f(i), 135 audio->split_bands_f(i),
136 audio->num_frames_per_band(), 136 audio->num_frames_per_band(),
137 apm_->stream_delay_ms(), 137 apm_->stream_delay_ms(),
138 stream_drift_samples_); 138 stream_drift_samples_);
139 139
140 if (err != apm_->kNoError) { 140 if (err != apm_->kNoError) {
141 err = GetHandleError(my_handle); 141 err = MapError(err);
142 // TODO(ajm): Figure out how to return warnings properly. 142 // TODO(ajm): Figure out how to return warnings properly.
143 if (err != apm_->kBadStreamParameterWarning) { 143 if (err != apm_->kBadStreamParameterWarning) {
144 return err; 144 return err;
145 } 145 }
146 } 146 }
147 147
148 int status = 0; 148 int status = 0;
149 err = WebRtcAec_get_echo_status(my_handle, &status); 149 err = WebRtcAec_get_echo_status(my_handle, &status);
150 if (err != apm_->kNoError) { 150 if (err != apm_->kNoError) {
151 return GetHandleError(my_handle); 151 return MapError(err);
152 } 152 }
153 153
154 if (status == 1) { 154 if (status == 1) {
155 stream_has_echo_ = true; 155 stream_has_echo_ = true;
156 } 156 }
157 157
158 handle_index++; 158 handle_index++;
159 } 159 }
160 } 160 }
161 161
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return apm_->kNotEnabledError; 233 return apm_->kNotEnabledError;
234 } 234 }
235 235
236 AecMetrics my_metrics; 236 AecMetrics my_metrics;
237 memset(&my_metrics, 0, sizeof(my_metrics)); 237 memset(&my_metrics, 0, sizeof(my_metrics));
238 memset(metrics, 0, sizeof(Metrics)); 238 memset(metrics, 0, sizeof(Metrics));
239 239
240 Handle* my_handle = static_cast<Handle*>(handle(0)); 240 Handle* my_handle = static_cast<Handle*>(handle(0));
241 int err = WebRtcAec_GetMetrics(my_handle, &my_metrics); 241 int err = WebRtcAec_GetMetrics(my_handle, &my_metrics);
242 if (err != apm_->kNoError) { 242 if (err != apm_->kNoError) {
243 return GetHandleError(my_handle); 243 return MapError(err);
244 } 244 }
245 245
246 metrics->residual_echo_return_loss.instant = my_metrics.rerl.instant; 246 metrics->residual_echo_return_loss.instant = my_metrics.rerl.instant;
247 metrics->residual_echo_return_loss.average = my_metrics.rerl.average; 247 metrics->residual_echo_return_loss.average = my_metrics.rerl.average;
248 metrics->residual_echo_return_loss.maximum = my_metrics.rerl.max; 248 metrics->residual_echo_return_loss.maximum = my_metrics.rerl.max;
249 metrics->residual_echo_return_loss.minimum = my_metrics.rerl.min; 249 metrics->residual_echo_return_loss.minimum = my_metrics.rerl.min;
250 250
251 metrics->echo_return_loss.instant = my_metrics.erl.instant; 251 metrics->echo_return_loss.instant = my_metrics.erl.instant;
252 metrics->echo_return_loss.average = my_metrics.erl.average; 252 metrics->echo_return_loss.average = my_metrics.erl.average;
253 metrics->echo_return_loss.maximum = my_metrics.erl.max; 253 metrics->echo_return_loss.maximum = my_metrics.erl.max;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 if (std == NULL) { 303 if (std == NULL) {
304 return apm_->kNullPointerError; 304 return apm_->kNullPointerError;
305 } 305 }
306 306
307 if (!is_component_enabled() || !delay_logging_enabled_) { 307 if (!is_component_enabled() || !delay_logging_enabled_) {
308 return apm_->kNotEnabledError; 308 return apm_->kNotEnabledError;
309 } 309 }
310 310
311 Handle* my_handle = static_cast<Handle*>(handle(0)); 311 Handle* my_handle = static_cast<Handle*>(handle(0));
312 if (WebRtcAec_GetDelayMetrics(my_handle, median, std, fraction_poor_delays) != 312 const int err =
313 apm_->kNoError) { 313 WebRtcAec_GetDelayMetrics(my_handle, median, std, fraction_poor_delays);
314 return GetHandleError(my_handle); 314 if (err != apm_->kNoError) {
315 return MapError(err);
315 } 316 }
316 317
317 return apm_->kNoError; 318 return apm_->kNoError;
318 } 319 }
319 320
320 struct AecCore* EchoCancellationImpl::aec_core() const { 321 struct AecCore* EchoCancellationImpl::aec_core() const {
321 CriticalSectionScoped crit_scoped(crit_); 322 CriticalSectionScoped crit_scoped(crit_);
322 if (!is_component_enabled()) { 323 if (!is_component_enabled()) {
323 return NULL; 324 return NULL;
324 } 325 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); 378 return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
378 } 379 }
379 380
380 int EchoCancellationImpl::num_handles_required() const { 381 int EchoCancellationImpl::num_handles_required() const {
381 return apm_->num_output_channels() * 382 return apm_->num_output_channels() *
382 apm_->num_reverse_channels(); 383 apm_->num_reverse_channels();
383 } 384 }
384 385
385 int EchoCancellationImpl::GetHandleError(void* handle) const { 386 int EchoCancellationImpl::GetHandleError(void* handle) const {
386 assert(handle != NULL); 387 assert(handle != NULL);
387 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle))); 388 return AudioProcessing::kUnspecifiedError;
388 } 389 }
389 } // namespace webrtc 390 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698