Inform the AEC3 echo remover about the status of the estimated delay
This CL adds functionality for passing the information about the
estimated delay to the echo remover in AEC3.
The CL also adds information about how long ago the delay changed,
and how long ago the delay estimate was updated.
Bug: webrtc:8671
Change-Id: If274ffe0465eb550f3e186d0599c6dc6fef7f5e8
Reviewed-on: https://webrtc-review.googlesource.com/55261
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22137}
diff --git a/modules/audio_processing/aec3/render_delay_controller.cc b/modules/audio_processing/aec3/render_delay_controller.cc
index e80280f..b95188d 100644
--- a/modules/audio_processing/aec3/render_delay_controller.cc
+++ b/modules/audio_processing/aec3/render_delay_controller.cc
@@ -130,7 +130,9 @@
}
}
- return DelayEstimate(estimated_delay.quality, new_delay_blocks);
+ DelayEstimate new_delay = estimated_delay;
+ new_delay.delay = new_delay_blocks;
+ return new_delay;
}
int RenderDelayControllerImpl::instance_count_ = 0;
@@ -194,7 +196,22 @@
if (!delay_samples_ || delay_samples->delay != delay_samples_->delay) {
delay_change_counter_ = 0;
}
- delay_samples_ = delay_samples;
+ if (delay_samples_) {
+ delay_samples_->blocks_since_last_change =
+ delay_samples_->delay == delay_samples->delay
+ ? delay_samples_->blocks_since_last_change + 1
+ : 0;
+ delay_samples_->blocks_since_last_update = 0;
+ delay_samples_->delay = delay_samples->delay;
+ delay_samples_->quality = delay_samples->quality;
+ } else {
+ delay_samples_ = delay_samples;
+ }
+ } else {
+ if (delay_samples_) {
+ ++delay_samples_->blocks_since_last_change;
+ ++delay_samples_->blocks_since_last_update;
+ }
}
if (delay_change_counter_ < 2 * kNumBlocksPerSecond) {