| Index: content/renderer/media/media_stream_audio_processor_options.cc
|
| diff --git a/content/renderer/media/media_stream_audio_processor_options.cc b/content/renderer/media/media_stream_audio_processor_options.cc
|
| index d9924fb70dfd2af5dbcba577c90da0b626fb9979..2a8eb5f35a8e8c89ce8a1ad7a6a521811c0db049 100644
|
| --- a/content/renderer/media/media_stream_audio_processor_options.cc
|
| +++ b/content/renderer/media/media_stream_audio_processor_options.cc
|
| @@ -221,28 +221,25 @@ bool MediaAudioConstraints::GetDefaultValueForConstraint(
|
| }
|
|
|
| EchoInformation::EchoInformation()
|
| - : num_chunks_(0),
|
| - num_queries_(0),
|
| - echo_fraction_poor_delays_(0.0f) {}
|
| + : num_chunks_(0) {}
|
|
|
| EchoInformation::~EchoInformation() {}
|
|
|
| void EchoInformation::UpdateAecDelayStats(
|
| webrtc::EchoCancellation* echo_cancellation) {
|
| // In WebRTC, three echo delay metrics are calculated and updated every
|
| - // second. We use one of them, |fraction_poor_delays|, but aggregate over
|
| - // five seconds to log in a UMA histogram to monitor Echo Cancellation
|
| - // quality. Since the stat in WebRTC has a fixed aggregation window of one
|
| - // second we query the stat every second and average over five such queries.
|
| - // WebRTC process audio in 10 ms chunks.
|
| - const int kNumChunksInOneSecond = 100;
|
| + // five seconds. We use one of them, |fraction_poor_delays| to log in a UMA
|
| + // histogram an Echo Cancellation quality metric. The stat in WebRTC has a
|
| + // fixed aggregation window of five seconds, so we use the same query
|
| + // frequency to avoid logging old values.
|
| + const int kNumChunksInFiveSeconds = 500;
|
| if (!echo_cancellation->is_delay_logging_enabled() ||
|
| !echo_cancellation->is_enabled()) {
|
| return;
|
| }
|
|
|
| num_chunks_++;
|
| - if (num_chunks_ < kNumChunksInOneSecond) {
|
| + if (num_chunks_ < kNumChunksInFiveSeconds) {
|
| return;
|
| }
|
|
|
| @@ -251,30 +248,13 @@ void EchoInformation::UpdateAecDelayStats(
|
| if (echo_cancellation->GetDelayMetrics(
|
| &dummy_median, &dummy_std, &fraction_poor_delays) ==
|
| webrtc::AudioProcessing::kNoError) {
|
| - echo_fraction_poor_delays_ += fraction_poor_delays;
|
| - num_queries_++;
|
| num_chunks_ = 0;
|
| }
|
| - LogAecDelayStats();
|
| -}
|
| -
|
| -void EchoInformation::LogAecDelayStats() {
|
| - // We update the UMA statistics every 5 seconds.
|
| - const int kNumQueriesIn5Seconds = 5;
|
| - if (num_queries_ < kNumQueriesIn5Seconds) {
|
| - return;
|
| - }
|
| -
|
| - // Calculate how frequent the AEC delay was out of bounds since last time we
|
| - // updated UMA histograms by averaging |echo_fraction_poor_delays_| over
|
| - // |num_queries_|. Then store the result into one of four histogram buckets;
|
| - // see DelayBasedEchoQuality.
|
| - float poor_delay_frequency = echo_fraction_poor_delays_ / num_queries_;
|
| + // Map |fraction_poor_delays| to an Echo Cancellation quality and log in UMA
|
| + // histogram. See DelayBasedEchoQuality for information on histogram buckets.
|
| UMA_HISTOGRAM_ENUMERATION("WebRTC.AecDelayBasedQuality",
|
| - EchoDelayFrequencyToQuality(poor_delay_frequency),
|
| + EchoDelayFrequencyToQuality(fraction_poor_delays),
|
| DELAY_BASED_ECHO_QUALITY_MAX);
|
| - num_queries_ = 0;
|
| - echo_fraction_poor_delays_ = 0.0f;
|
| }
|
|
|
| void EnableEchoCancellation(AudioProcessing* audio_processing) {
|
|
|