Skip to content

Commit

Permalink
Remove the reporting of histogram data for AEC2
Browse files Browse the repository at this point in the history
This CL removes the legacy reporting of histogram data for AEC2.

Bug: webrtc:5298
Change-Id: I838e729e0fb78d28e16de0fa79ddf5c857682d65
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135101
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27834}
  • Loading branch information
Per Åhgren authored and Commit Bot committed May 3, 2019
1 parent 4731f00 commit ea4c5df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 85 deletions.
82 changes: 2 additions & 80 deletions modules/audio_processing/audio_processing_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,6 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
!!private_submodules_->echo_control_mobile,
1);

MaybeUpdateHistograms();

AudioBuffer* capture_buffer = capture_.capture_audio.get(); // For brevity.

if (private_submodules_->pre_amplifier) {
Expand Down Expand Up @@ -1951,79 +1949,7 @@ void AudioProcessingImpl::InitializePreProcessor() {
}
}

void AudioProcessingImpl::MaybeUpdateHistograms() {
static const int kMinDiffDelayMs = 60;

if (private_submodules_->echo_cancellation &&
private_submodules_->echo_cancellation->is_enabled()) {
// Activate delay_jumps_ counters if we know echo_cancellation is running.
// If a stream has echo we know that the echo_cancellation is in process.
if (capture_.stream_delay_jumps == -1 &&
private_submodules_->echo_cancellation->stream_has_echo()) {
capture_.stream_delay_jumps = 0;
}
if (capture_.aec_system_delay_jumps == -1 &&
private_submodules_->echo_cancellation->stream_has_echo()) {
capture_.aec_system_delay_jumps = 0;
}

// Detect a jump in platform reported system delay and log the difference.
const int diff_stream_delay_ms =
capture_nonlocked_.stream_delay_ms - capture_.last_stream_delay_ms;
if (diff_stream_delay_ms > kMinDiffDelayMs &&
capture_.last_stream_delay_ms != 0) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.PlatformReportedStreamDelayJump",
diff_stream_delay_ms, kMinDiffDelayMs, 1000, 100);
if (capture_.stream_delay_jumps == -1) {
capture_.stream_delay_jumps = 0; // Activate counter if needed.
}
capture_.stream_delay_jumps++;
}
capture_.last_stream_delay_ms = capture_nonlocked_.stream_delay_ms;

// Detect a jump in AEC system delay and log the difference.
const int samples_per_ms =
rtc::CheckedDivExact(capture_nonlocked_.split_rate, 1000);
RTC_DCHECK_LT(0, samples_per_ms);
const int aec_system_delay_ms =
private_submodules_->echo_cancellation->GetSystemDelayInSamples() /
samples_per_ms;
const int diff_aec_system_delay_ms =
aec_system_delay_ms - capture_.last_aec_system_delay_ms;
if (diff_aec_system_delay_ms > kMinDiffDelayMs &&
capture_.last_aec_system_delay_ms != 0) {
RTC_HISTOGRAM_COUNTS("WebRTC.Audio.AecSystemDelayJump",
diff_aec_system_delay_ms, kMinDiffDelayMs, 1000,
100);
if (capture_.aec_system_delay_jumps == -1) {
capture_.aec_system_delay_jumps = 0; // Activate counter if needed.
}
capture_.aec_system_delay_jumps++;
}
capture_.last_aec_system_delay_ms = aec_system_delay_ms;
}
}

void AudioProcessingImpl::UpdateHistogramsOnCallEnd() {
// Run in a single-threaded manner.
rtc::CritScope cs_render(&crit_render_);
rtc::CritScope cs_capture(&crit_capture_);

if (capture_.stream_delay_jumps > -1) {
RTC_HISTOGRAM_ENUMERATION(
"WebRTC.Audio.NumOfPlatformReportedStreamDelayJumps",
capture_.stream_delay_jumps, 51);
}
capture_.stream_delay_jumps = -1;
capture_.last_stream_delay_ms = 0;

if (capture_.aec_system_delay_jumps > -1) {
RTC_HISTOGRAM_ENUMERATION("WebRTC.Audio.NumOfAecSystemDelayJumps",
capture_.aec_system_delay_jumps, 51);
}
capture_.aec_system_delay_jumps = -1;
capture_.last_aec_system_delay_ms = 0;
}
void AudioProcessingImpl::UpdateHistogramsOnCallEnd() {}

void AudioProcessingImpl::WriteAecDumpConfigMessage(bool forced) {
if (!aec_dump_) {
Expand Down Expand Up @@ -2160,12 +2086,8 @@ void AudioProcessingImpl::RecordAudioProcessingState() {

AudioProcessingImpl::ApmCaptureState::ApmCaptureState(
bool transient_suppressor_enabled)
: aec_system_delay_jumps(-1),
delay_offset_ms(0),
: delay_offset_ms(0),
was_stream_delay_set(false),
last_stream_delay_ms(0),
last_aec_system_delay_ms(0),
stream_delay_jumps(-1),
output_will_be_muted(false),
key_pressed(false),
transient_suppressor_enabled(transient_suppressor_enabled),
Expand Down
5 changes: 0 additions & 5 deletions modules/audio_processing/audio_processing_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ class AudioProcessingImpl : public AudioProcessing {
// Capture-side exclusive methods possibly running APM in a multi-threaded
// manner that are called with the render lock already acquired.
int ProcessCaptureStreamLocked() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);
void MaybeUpdateHistograms() RTC_EXCLUSIVE_LOCKS_REQUIRED(crit_capture_);

// Render-side exclusive methods possibly running APM in a multi-threaded
// manner that are called with the render lock already acquired.
Expand Down Expand Up @@ -385,12 +384,8 @@ class AudioProcessingImpl : public AudioProcessing {
struct ApmCaptureState {
ApmCaptureState(bool transient_suppressor_enabled);
~ApmCaptureState();
int aec_system_delay_jumps;
int delay_offset_ms;
bool was_stream_delay_set;
int last_stream_delay_ms;
int last_aec_system_delay_ms;
int stream_delay_jumps;
bool output_will_be_muted;
bool key_pressed;
bool transient_suppressor_enabled;
Expand Down
2 changes: 2 additions & 0 deletions modules/audio_processing/include/audio_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ class AudioProcessing : public rtc::RefCountInterface {

// Use to send UMA histograms at end of a call. Note that all histogram
// specific member variables are reset.
// Deprecated. This method is deprecated and will be removed.
// TODO(peah): Remove this method.
virtual void UpdateHistogramsOnCallEnd() = 0;

// Get audio processing statistics. The |has_remote_tracks| argument should be
Expand Down

0 comments on commit ea4c5df

Please sign in to comment.