diff options
author | bjornv <bjornv@chromium.org> | 2015-03-07 15:01:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-07 23:03:15 +0000 |
commit | 971f184b39b257dd7cf053a8711faf1ec977035a (patch) | |
tree | 838da099db6d58f4602ac81a525f0bd109a4e0b5 /content | |
parent | 0b7c0c442edced1ab10b0c5208d5d0998923cc17 (diff) | |
download | chromium_src-971f184b39b257dd7cf053a8711faf1ec977035a.zip chromium_src-971f184b39b257dd7cf053a8711faf1ec977035a.tar.gz chromium_src-971f184b39b257dd7cf053a8711faf1ec977035a.tar.bz2 |
Simplify WebRTC DelayMetrics query in MediaStreamAudioProcessor
As of webrtc roll https://chromium.googlesource.com/chromium/src/+/724ab4480d4af0c4a64752078a7cd5046782789c
a longer aggregation window is used and we can now match it to simplify the query.
BUG=450193
TESTED=locally on Mac
Review URL: https://codereview.chromium.org/982333002
Cr-Commit-Position: refs/heads/master@{#319564}
Diffstat (limited to 'content')
-rw-r--r-- | content/renderer/media/media_stream_audio_processor_options.cc | 40 | ||||
-rw-r--r-- | content/renderer/media/media_stream_audio_processor_options.h | 9 |
2 files changed, 12 insertions, 37 deletions
diff --git a/content/renderer/media/media_stream_audio_processor_options.cc b/content/renderer/media/media_stream_audio_processor_options.cc index d9924fb..2a8eb5f 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) { diff --git a/content/renderer/media/media_stream_audio_processor_options.h b/content/renderer/media/media_stream_audio_processor_options.h index c9c0dcc..2600757 100644 --- a/content/renderer/media/media_stream_audio_processor_options.h +++ b/content/renderer/media/media_stream_audio_processor_options.h @@ -97,14 +97,9 @@ class CONTENT_EXPORT EchoInformation { void UpdateAecDelayStats(webrtc::EchoCancellation* echo_cancellation); private: - // Updates UMA histograms with an interval of 5 seconds. - void LogAecDelayStats(); - - // Counters to be able to aquire a 5 second aggregated metric out of 1 second - // aggregated webrtc::EchoCancellation::GetEchoDelayMetrics() queries. + // Counter to track 5 seconds of processed 10 ms chunks in order to query a + // new metric from webrtc::EchoCancellation::GetEchoDelayMetrics(). int num_chunks_; - int num_queries_; - float echo_fraction_poor_delays_; DISALLOW_COPY_AND_ASSIGN(EchoInformation); }; |