diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 9ca81e69e3..ac8afdac64 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -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) { @@ -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_) { @@ -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), diff --git a/modules/audio_processing/audio_processing_impl.h b/modules/audio_processing/audio_processing_impl.h index 6b185d064d..47eed0a1b7 100644 --- a/modules/audio_processing/audio_processing_impl.h +++ b/modules/audio_processing/audio_processing_impl.h @@ -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. @@ -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; diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h index 4477e812f5..68054d18ea 100644 --- a/modules/audio_processing/include/audio_processing.h +++ b/modules/audio_processing/include/audio_processing.h @@ -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