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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 formats_.api_format.output_stream().num_frames())); | 436 formats_.api_format.output_stream().num_frames())); |
437 | 437 |
438 public_submodules_->gain_control->Initialize(num_proc_channels(), | 438 public_submodules_->gain_control->Initialize(num_proc_channels(), |
439 proc_sample_rate_hz()); | 439 proc_sample_rate_hz()); |
440 | 440 |
441 public_submodules_->echo_cancellation->Initialize( | 441 public_submodules_->echo_cancellation->Initialize( |
442 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(), | 442 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(), |
443 num_proc_channels()); | 443 num_proc_channels()); |
444 AllocateRenderQueue(); | 444 AllocateRenderQueue(); |
445 | 445 |
| 446 int success = public_submodules_->echo_cancellation->enable_metrics(true); |
| 447 RTC_DCHECK_EQ(0, success); |
| 448 success = public_submodules_->echo_cancellation->enable_delay_logging(true); |
| 449 RTC_DCHECK_EQ(0, success); |
446 public_submodules_->echo_control_mobile->Initialize( | 450 public_submodules_->echo_control_mobile->Initialize( |
447 proc_split_sample_rate_hz(), num_reverse_channels(), | 451 proc_split_sample_rate_hz(), num_reverse_channels(), |
448 num_output_channels()); | 452 num_output_channels()); |
449 if (constants_.use_experimental_agc) { | 453 if (constants_.use_experimental_agc) { |
450 if (!private_submodules_->agc_manager.get()) { | 454 if (!private_submodules_->agc_manager.get()) { |
451 private_submodules_->agc_manager.reset(new AgcManagerDirect( | 455 private_submodules_->agc_manager.reset(new AgcManagerDirect( |
452 public_submodules_->gain_control.get(), | 456 public_submodules_->gain_control.get(), |
453 public_submodules_->gain_control_for_experimental_agc.get(), | 457 public_submodules_->gain_control_for_experimental_agc.get(), |
454 constants_.agc_startup_min_volume)); | 458 constants_.agc_startup_min_volume)); |
455 } | 459 } |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 | 1414 |
1411 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1415 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
1412 // We just return if recording hasn't started. | 1416 // We just return if recording hasn't started. |
1413 debug_dump_.debug_file->CloseFile(); | 1417 debug_dump_.debug_file->CloseFile(); |
1414 return kNoError; | 1418 return kNoError; |
1415 #else | 1419 #else |
1416 return kUnsupportedFunctionError; | 1420 return kUnsupportedFunctionError; |
1417 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1421 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1418 } | 1422 } |
1419 | 1423 |
| 1424 AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics() |
| 1425 const { |
| 1426 AudioProcessingStatistics stats; |
| 1427 EchoCancellation::Metrics metrics; |
| 1428 public_submodules_->echo_cancellation->GetMetrics(&metrics); |
| 1429 stats.a_nlp.Set(metrics.a_nlp); |
| 1430 stats.divergent_filter_fraction = metrics.divergent_filter_fraction; |
| 1431 stats.echo_return_loss.Set(metrics.echo_return_loss); |
| 1432 stats.echo_return_loss_enhancement.Set(metrics.echo_return_loss_enhancement); |
| 1433 stats.residual_echo_return_loss.Set(metrics.residual_echo_return_loss); |
| 1434 public_submodules_->echo_cancellation->GetDelayMetrics( |
| 1435 &stats.delay_median, &stats.delay_standard_deviation, |
| 1436 &stats.fraction_poor_delays); |
| 1437 return stats; |
| 1438 } |
| 1439 |
1420 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { | 1440 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { |
1421 return public_submodules_->echo_cancellation.get(); | 1441 return public_submodules_->echo_cancellation.get(); |
1422 } | 1442 } |
1423 | 1443 |
1424 EchoControlMobile* AudioProcessingImpl::echo_control_mobile() const { | 1444 EchoControlMobile* AudioProcessingImpl::echo_control_mobile() const { |
1425 return public_submodules_->echo_control_mobile.get(); | 1445 return public_submodules_->echo_control_mobile.get(); |
1426 } | 1446 } |
1427 | 1447 |
1428 GainControl* AudioProcessingImpl::gain_control() const { | 1448 GainControl* AudioProcessingImpl::gain_control() const { |
1429 if (constants_.use_experimental_agc) { | 1449 if (constants_.use_experimental_agc) { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1733 capture_processing_format(kSampleRate16kHz), | 1753 capture_processing_format(kSampleRate16kHz), |
1734 split_rate(kSampleRate16kHz) {} | 1754 split_rate(kSampleRate16kHz) {} |
1735 | 1755 |
1736 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; | 1756 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; |
1737 | 1757 |
1738 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; | 1758 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; |
1739 | 1759 |
1740 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; | 1760 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; |
1741 | 1761 |
1742 } // namespace webrtc | 1762 } // namespace webrtc |
OLD | NEW |