Commit 40d81fd5 authored by bjornv's avatar bjornv Committed by Commit bot

[media_stream_audio_processor] Avoids updating UMA stats before AEC has valid results

Stats are updated and logged continuously when echo cancellation is enabled. Being enabled is no guarantee for actually running since it, for example, is enabled by default when opening the microphone.
All these invalid data clutter the UMA histogram.

The improvement is a check for the first frame containing an echo state before start logging. This can only happen when the echo cancellation is actually running.

BUG=450193

Review URL: https://codereview.chromium.org/1081063003

Cr-Commit-Position: refs/heads/master@{#326761}
parent c6f2f80d
...@@ -222,12 +222,20 @@ bool MediaAudioConstraints::GetDefaultValueForConstraint( ...@@ -222,12 +222,20 @@ bool MediaAudioConstraints::GetDefaultValueForConstraint(
} }
EchoInformation::EchoInformation() EchoInformation::EchoInformation()
: num_chunks_(0) {} : num_chunks_(0), echo_frames_received_(false) {
}
EchoInformation::~EchoInformation() {} EchoInformation::~EchoInformation() {}
void EchoInformation::UpdateAecDelayStats( void EchoInformation::UpdateAecDelayStats(
webrtc::EchoCancellation* echo_cancellation) { webrtc::EchoCancellation* echo_cancellation) {
// Only start collecting stats if we know echo cancellation has measured an
// echo. Otherwise we clutter the stats with for example cases where only the
// microphone is used.
if (!echo_frames_received_ & !echo_cancellation->stream_has_echo())
return;
echo_frames_received_ = true;
// In WebRTC, three echo delay metrics are calculated and updated every // In WebRTC, three echo delay metrics are calculated and updated every
// five seconds. We use one of them, |fraction_poor_delays| to log in a UMA // 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 // histogram an Echo Cancellation quality metric. The stat in WebRTC has a
......
...@@ -101,6 +101,7 @@ class CONTENT_EXPORT EchoInformation { ...@@ -101,6 +101,7 @@ class CONTENT_EXPORT EchoInformation {
// Counter to track 5 seconds of processed 10 ms chunks in order to query a // Counter to track 5 seconds of processed 10 ms chunks in order to query a
// new metric from webrtc::EchoCancellation::GetEchoDelayMetrics(). // new metric from webrtc::EchoCancellation::GetEchoDelayMetrics().
int num_chunks_; int num_chunks_;
bool echo_frames_received_;
DISALLOW_COPY_AND_ASSIGN(EchoInformation); DISALLOW_COPY_AND_ASSIGN(EchoInformation);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment