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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 #if defined(OS_ANDROID) || defined(OS_IOS) | 175 #if defined(OS_ANDROID) || defined(OS_IOS) |
176 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; | 176 const webrtc::GainControl::Mode mode = webrtc::GainControl::kFixedDigital; |
177 #else | 177 #else |
178 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; | 178 const webrtc::GainControl::Mode mode = webrtc::GainControl::kAdaptiveAnalog; |
179 #endif | 179 #endif |
180 int err = audio_processing->gain_control()->set_mode(mode); | 180 int err = audio_processing->gain_control()->set_mode(mode); |
181 err |= audio_processing->gain_control()->Enable(true); | 181 err |= audio_processing->gain_control()->Enable(true); |
182 CHECK_EQ(err, 0); | 182 CHECK_EQ(err, 0); |
183 } | 183 } |
184 | 184 |
| 185 void GetAecStats(AudioProcessing* audio_processing, |
| 186 webrtc::AudioProcessorInterface::AudioProcessorStats* stats) { |
| 187 // These values can take on valid negative values, so use the lowest possible |
| 188 // level as default rather than -1. |
| 189 stats->echo_return_loss = -100; |
| 190 stats->echo_return_loss_enhancement = -100; |
| 191 |
| 192 // These values can also be negative, but in practice -1 is only used to |
| 193 // signal insufficient data, since the resolution is limited to multiples |
| 194 // of 4ms. |
| 195 stats->echo_delay_median_ms = -1; |
| 196 stats->echo_delay_std_ms = -1; |
| 197 |
| 198 // TODO(ajm): Re-enable this metric once we have a reliable implementation. |
| 199 stats->aec_quality_min = -1.0f; |
| 200 |
| 201 if (!audio_processing->echo_cancellation()->are_metrics_enabled() || |
| 202 !audio_processing->echo_cancellation()->is_delay_logging_enabled() || |
| 203 !audio_processing->echo_cancellation()->is_enabled()) { |
| 204 return; |
| 205 } |
| 206 |
| 207 // TODO(ajm): we may want to use VoECallReport::GetEchoMetricsSummary |
| 208 // here, but it appears to be unsuitable currently. Revisit after this is |
| 209 // investigated: http://b/issue?id=5666755 |
| 210 webrtc::EchoCancellation::Metrics echo_metrics; |
| 211 if (!audio_processing->echo_cancellation()->GetMetrics(&echo_metrics)) { |
| 212 stats->echo_return_loss = echo_metrics.echo_return_loss.instant; |
| 213 stats->echo_return_loss_enhancement = |
| 214 echo_metrics.echo_return_loss_enhancement.instant; |
| 215 } |
| 216 |
| 217 int median = 0, std = 0; |
| 218 if (!audio_processing->echo_cancellation()->GetDelayMetrics(&median, &std)) { |
| 219 stats->echo_delay_median_ms = median; |
| 220 stats->echo_delay_std_ms = std; |
| 221 } |
| 222 } |
| 223 |
185 } // namespace content | 224 } // namespace content |
OLD | NEW |