Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/media_stream_audio_processor_options.h" | 5 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 #if defined(OS_ANDROID) || defined(OS_IOS) | 171 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 172 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; | 172 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; |
| 173 #else | 173 #else |
| 174 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; | 174 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; |
| 175 #endif | 175 #endif |
| 176 int err = audio_processing->gain_control()->set_mode(mode); | 176 int err = audio_processing->gain_control()->set_mode(mode); |
| 177 err |= audio_processing->gain_control()->Enable(true); | 177 err |= audio_processing->gain_control()->Enable(true); |
| 178 CHECK_EQ(err, 0); | 178 CHECK_EQ(err, 0); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void GetAecStats(AudioProcessing* audio_processing, | |
|
ajm
2014/03/04 02:23:12
How often is this method polled? Calling GetMetric
no longer working on chromium
2014/03/04 15:48:59
Definitely.
The method is triggered by StatsColle
| |
| 182 webrtc::AudioProcessorInterface::AudioProcessorStats* stats) { | |
| 183 // These values can take on valid negative values, so use the lowest possible | |
| 184 // level as default rather than -1. | |
| 185 stats->echo_return_loss = -100; | |
|
tommi (sloooow) - chröme
2014/03/03 15:25:18
Where is it documented that these are the lowest p
ajm
2014/03/04 02:23:12
I had a look and unfortunately it's not documented
no longer working on chromium
2014/03/04 15:48:59
Thanks.
| |
| 186 stats->echo_return_loss_enhancement = -100; | |
| 187 | |
| 188 // These values can also be negative, but in practice -1 is only used to | |
| 189 // signal insufficient data, since the resolution is limited to multiples | |
| 190 // of 4ms. | |
| 191 stats->echo_delay_median_ms = -1; | |
| 192 stats->echo_delay_std_ms = -1; | |
| 193 | |
| 194 // TODO(ajm): Re-enable this metric once we have a reliable implementation. | |
| 195 stats->aec_quality_min = -1.0f; | |
| 196 | |
| 197 if (!audio_processing->echo_cancellation()->are_metrics_enabled() || | |
| 198 !audio_processing->echo_cancellation()->is_delay_logging_enabled() || | |
| 199 !audio_processing->echo_cancellation()->is_enabled()) { | |
| 200 return; | |
| 201 } | |
| 202 | |
| 203 // TODO(ajm): we may want to use VoECallReport::GetEchoMetricsSummary | |
| 204 // here, but it appears to be unsuitable currently. Revisit after this is | |
| 205 // investigated: http://b/issue?id=5666755 | |
| 206 webrtc::EchoCancellation::Metrics echo_metrics; | |
| 207 if (!audio_processing->echo_cancellation()->GetMetrics(&echo_metrics)) { | |
| 208 stats->echo_return_loss = echo_metrics.echo_return_loss.instant; | |
| 209 stats->echo_return_loss_enhancement = | |
| 210 echo_metrics.echo_return_loss_enhancement.instant; | |
| 211 } | |
| 212 | |
| 213 int median = 0, std = 0; | |
| 214 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { | |
| 215 stats->echo_delay_median_ms = median; | |
| 216 stats->echo_delay_std_ms = std; | |
| 217 } | |
| 218 } | |
| 219 | |
| 181 } // namespace content | 220 } // namespace content |
| OLD | NEW |