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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 | 215 |
| 216 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { | 216 for (size_t i = 0; i < arraysize(kDefaultAudioConstraints); ++i) { |
| 217 if (kDefaultAudioConstraints[i].key == key) | 217 if (kDefaultAudioConstraints[i].key == key) |
| 218 return kDefaultAudioConstraints[i].value; | 218 return kDefaultAudioConstraints[i].value; |
| 219 } | 219 } |
| 220 | 220 |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| 223 | 223 |
| 224 EchoInformation::EchoInformation() | 224 EchoInformation::EchoInformation() |
| 225 : num_chunks_(0) {} | 225 : num_chunks_(0), echo_frames_received_(false) { |
| 226 } | |
| 226 | 227 |
| 227 EchoInformation::~EchoInformation() {} | 228 EchoInformation::~EchoInformation() {} |
| 228 | 229 |
| 229 void EchoInformation::UpdateAecDelayStats( | 230 void EchoInformation::UpdateAecDelayStats( |
| 230 webrtc::EchoCancellation* echo_cancellation) { | 231 webrtc::EchoCancellation* echo_cancellation) { |
| 232 // Only start collecting stats if we know echo cancellation has measured an | |
| 233 // echo. Otherwise we clutter the stats with for example cases where only the | |
| 234 // microphone is used. | |
| 235 if (!echo_frames_received_ & !echo_cancellation->stream_has_echo()) { | |
|
tommi (sloooow) - chröme
2015/04/23 14:35:35
no {}
bjornv
2015/04/24 08:01:55
Done.
| |
| 236 return; | |
| 237 } | |
| 238 echo_frames_received_ = true; | |
| 231 // In WebRTC, three echo delay metrics are calculated and updated every | 239 // In WebRTC, three echo delay metrics are calculated and updated every |
| 232 // five seconds. We use one of them, |fraction_poor_delays| to log in a UMA | 240 // five seconds. We use one of them, |fraction_poor_delays| to log in a UMA |
| 233 // histogram an Echo Cancellation quality metric. The stat in WebRTC has a | 241 // histogram an Echo Cancellation quality metric. The stat in WebRTC has a |
| 234 // fixed aggregation window of five seconds, so we use the same query | 242 // fixed aggregation window of five seconds, so we use the same query |
| 235 // frequency to avoid logging old values. | 243 // frequency to avoid logging old values. |
| 236 const int kNumChunksInFiveSeconds = 500; | 244 const int kNumChunksInFiveSeconds = 500; |
| 237 if (!echo_cancellation->is_delay_logging_enabled() || | 245 if (!echo_cancellation->is_delay_logging_enabled() || |
| 238 !echo_cancellation->is_enabled()) { | 246 !echo_cancellation->is_enabled()) { |
| 239 return; | 247 return; |
| 240 } | 248 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 int median = 0, std = 0; | 378 int median = 0, std = 0; |
| 371 float dummy = 0; | 379 float dummy = 0; |
| 372 if (echo_cancellation->GetDelayMetrics(&median, &std, &dummy) == | 380 if (echo_cancellation->GetDelayMetrics(&median, &std, &dummy) == |
| 373 webrtc::AudioProcessing::kNoError) { | 381 webrtc::AudioProcessing::kNoError) { |
| 374 stats->echo_delay_median_ms = median; | 382 stats->echo_delay_median_ms = median; |
| 375 stats->echo_delay_std_ms = std; | 383 stats->echo_delay_std_ms = std; |
| 376 } | 384 } |
| 377 } | 385 } |
| 378 | 386 |
| 379 } // namespace content | 387 } // namespace content |
| OLD | NEW |