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

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

Issue 2433153003: New statistics interface for APM (Closed)
Patch Set: Review comments. Created 4 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 formats_.api_format.input_stream().num_channels(), 426 formats_.api_format.input_stream().num_channels(),
427 capture_nonlocked_.capture_processing_format.num_frames(), 427 capture_nonlocked_.capture_processing_format.num_frames(),
428 capture_audiobuffer_num_channels, 428 capture_audiobuffer_num_channels,
429 formats_.api_format.output_stream().num_frames())); 429 formats_.api_format.output_stream().num_frames()));
430 430
431 public_submodules_->gain_control->Initialize(num_proc_channels(), 431 public_submodules_->gain_control->Initialize(num_proc_channels(),
432 proc_sample_rate_hz()); 432 proc_sample_rate_hz());
433 public_submodules_->echo_cancellation->Initialize( 433 public_submodules_->echo_cancellation->Initialize(
434 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(), 434 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(),
435 num_proc_channels()); 435 num_proc_channels());
436 int success = public_submodules_->echo_cancellation->enable_metrics(true);
437 RTC_DCHECK_EQ(0, success);
438 success = public_submodules_->echo_cancellation->enable_delay_logging(true);
439 RTC_DCHECK_EQ(0, success);
436 public_submodules_->echo_control_mobile->Initialize( 440 public_submodules_->echo_control_mobile->Initialize(
437 proc_split_sample_rate_hz(), num_reverse_channels(), 441 proc_split_sample_rate_hz(), num_reverse_channels(),
438 num_output_channels()); 442 num_output_channels());
439 if (constants_.use_experimental_agc) { 443 if (constants_.use_experimental_agc) {
440 if (!private_submodules_->agc_manager.get()) { 444 if (!private_submodules_->agc_manager.get()) {
441 private_submodules_->agc_manager.reset(new AgcManagerDirect( 445 private_submodules_->agc_manager.reset(new AgcManagerDirect(
442 public_submodules_->gain_control.get(), 446 public_submodules_->gain_control.get(),
443 public_submodules_->gain_control_for_experimental_agc.get(), 447 public_submodules_->gain_control_for_experimental_agc.get(),
444 constants_.agc_startup_min_volume)); 448 constants_.agc_startup_min_volume));
445 } 449 }
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1275
1272 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 1276 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
1273 // We just return if recording hasn't started. 1277 // We just return if recording hasn't started.
1274 debug_dump_.debug_file->CloseFile(); 1278 debug_dump_.debug_file->CloseFile();
1275 return kNoError; 1279 return kNoError;
1276 #else 1280 #else
1277 return kUnsupportedFunctionError; 1281 return kUnsupportedFunctionError;
1278 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1282 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1279 } 1283 }
1280 1284
1285 AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics()
1286 const {
1287 AudioProcessingStatistics stats;
1288 EchoCancellation::Metrics metrics;
1289 public_submodules_->echo_cancellation->GetMetrics(&metrics);
1290 stats.a_nlp = metrics.a_nlp;
1291 stats.divergent_filter_fraction = metrics.divergent_filter_fraction;
1292 stats.echo_return_loss = metrics.echo_return_loss;
1293 stats.echo_return_loss_enhancement = metrics.echo_return_loss_enhancement;
1294 stats.residual_echo_return_loss = metrics.residual_echo_return_loss;
1295 public_submodules_->echo_cancellation->GetDelayMetrics(
1296 &stats.delay_median, &stats.delay_standard_deviation,
1297 &stats.fraction_poor_delays);
1298 return stats;
1299 }
1300
1281 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { 1301 EchoCancellation* AudioProcessingImpl::echo_cancellation() const {
1282 return public_submodules_->echo_cancellation.get(); 1302 return public_submodules_->echo_cancellation.get();
1283 } 1303 }
1284 1304
1285 EchoControlMobile* AudioProcessingImpl::echo_control_mobile() const { 1305 EchoControlMobile* AudioProcessingImpl::echo_control_mobile() const {
1286 return public_submodules_->echo_control_mobile.get(); 1306 return public_submodules_->echo_control_mobile.get();
1287 } 1307 }
1288 1308
1289 GainControl* AudioProcessingImpl::gain_control() const { 1309 GainControl* AudioProcessingImpl::gain_control() const {
1290 if (constants_.use_experimental_agc) { 1310 if (constants_.use_experimental_agc) {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 capture_processing_format(kSampleRate16kHz), 1614 capture_processing_format(kSampleRate16kHz),
1595 split_rate(kSampleRate16kHz) {} 1615 split_rate(kSampleRate16kHz) {}
1596 1616
1597 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1617 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1598 1618
1599 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1619 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1600 1620
1601 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1621 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1602 1622
1603 } // namespace webrtc 1623 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698