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

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

Issue 2463813002: Make use of new APM statistics interface. (Closed)
Patch Set: Speculative fix for bots. 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
« no previous file with comments | « webrtc/audio/audio_send_stream_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return uppermost_native_rate; 113 return uppermost_native_rate;
114 } 114 }
115 if (rate >= minimum_rate) { 115 if (rate >= minimum_rate) {
116 return rate; 116 return rate;
117 } 117 }
118 } 118 }
119 RTC_NOTREACHED(); 119 RTC_NOTREACHED();
120 return uppermost_native_rate; 120 return uppermost_native_rate;
121 } 121 }
122 122
123 webrtc::AudioProcessing::Statistic FixStatistic(
124 const webrtc::AudioProcessing::Statistic& stat) {
125 webrtc::AudioProcessing::Statistic result = stat;
126 if (result.average == -100 || result.instant == -100 ||
127 result.maximum == -100 || result.minimum == -100) {
128 result.average = result.instant = result.maximum = result.minimum = -100;
129 }
130 return result;
131 }
132
123 // Maximum length that a frame of samples can have. 133 // Maximum length that a frame of samples can have.
124 static const size_t kMaxAllowedValuesOfSamplesPerFrame = 160; 134 static const size_t kMaxAllowedValuesOfSamplesPerFrame = 160;
125 // Maximum number of frames to buffer in the render queue. 135 // Maximum number of frames to buffer in the render queue.
126 // TODO(peah): Decrease this once we properly handle hugely unbalanced 136 // TODO(peah): Decrease this once we properly handle hugely unbalanced
127 // reverse and forward call numbers. 137 // reverse and forward call numbers.
128 static const size_t kMaxNumFramesToBuffer = 100; 138 static const size_t kMaxNumFramesToBuffer = 100;
129 139
130 } // namespace 140 } // namespace
131 141
132 // Throughout webrtc, it's assumed that success is represented by zero. 142 // Throughout webrtc, it's assumed that success is represented by zero.
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 const { 1492 const {
1483 return AudioProcessingStatistics(); 1493 return AudioProcessingStatistics();
1484 } 1494 }
1485 1495
1486 AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics() 1496 AudioProcessing::AudioProcessingStatistics AudioProcessingImpl::GetStatistics()
1487 const { 1497 const {
1488 AudioProcessingStatistics stats; 1498 AudioProcessingStatistics stats;
1489 EchoCancellation::Metrics metrics; 1499 EchoCancellation::Metrics metrics;
1490 int success = public_submodules_->echo_cancellation->GetMetrics(&metrics); 1500 int success = public_submodules_->echo_cancellation->GetMetrics(&metrics);
1491 if (success == Error::kNoError) { 1501 if (success == Error::kNoError) {
1492 stats.a_nlp.Set(metrics.a_nlp); 1502 stats.a_nlp.Set(FixStatistic(metrics.a_nlp));
peah-webrtc 2016/11/10 10:36:09 What you do here is basically to ensure that if an
ossu 2016/11/10 11:29:47 peah: Did you read my analysis of the problem in q
1493 stats.divergent_filter_fraction = metrics.divergent_filter_fraction; 1503 stats.divergent_filter_fraction = metrics.divergent_filter_fraction;
1494 stats.echo_return_loss.Set(metrics.echo_return_loss); 1504 stats.echo_return_loss.Set(FixStatistic(metrics.echo_return_loss));
1495 stats.echo_return_loss_enhancement.Set( 1505 stats.echo_return_loss_enhancement.Set(
1496 metrics.echo_return_loss_enhancement); 1506 FixStatistic(metrics.echo_return_loss_enhancement));
1497 stats.residual_echo_return_loss.Set(metrics.residual_echo_return_loss); 1507 stats.residual_echo_return_loss.Set(
1508 FixStatistic(metrics.residual_echo_return_loss));
1498 } 1509 }
1499 public_submodules_->echo_cancellation->GetDelayMetrics( 1510 public_submodules_->echo_cancellation->GetDelayMetrics(
1500 &stats.delay_median, &stats.delay_standard_deviation, 1511 &stats.delay_median, &stats.delay_standard_deviation,
1501 &stats.fraction_poor_delays); 1512 &stats.fraction_poor_delays);
1502 return stats; 1513 return stats;
1503 } 1514 }
1504 1515
1505 EchoCancellation* AudioProcessingImpl::echo_cancellation() const { 1516 EchoCancellation* AudioProcessingImpl::echo_cancellation() const {
1506 return public_submodules_->echo_cancellation.get(); 1517 return public_submodules_->echo_cancellation.get();
1507 } 1518 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 capture_processing_format(kSampleRate16kHz), 1834 capture_processing_format(kSampleRate16kHz),
1824 split_rate(kSampleRate16kHz) {} 1835 split_rate(kSampleRate16kHz) {}
1825 1836
1826 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1837 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1827 1838
1828 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1839 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1829 1840
1830 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1841 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1831 1842
1832 } // namespace webrtc 1843 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/audio/audio_send_stream_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698