Redesign of the render buffering in AEC3
This CL centralizes the render buffering in AEC3 so that all render
buffers are updated and synchronized/aligned with the render alignment
buffer.
Bug: webrtc:8597, chromium:790905
Change-Id: I8a94e5c1f27316b6100b420eec9652ea31c1a91d
Reviewed-on: https://webrtc-review.googlesource.com/25680
Commit-Queue: Per Åhgren <peah@webrtc.org>
Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20989}
diff --git a/modules/audio_processing/aec3/render_delay_controller.cc b/modules/audio_processing/aec3/render_delay_controller.cc
index 2c1f263..05121f2 100644
--- a/modules/audio_processing/aec3/render_delay_controller.cc
+++ b/modules/audio_processing/aec3/render_delay_controller.cc
@@ -41,8 +41,10 @@
private:
static int instance_count_;
std::unique_ptr<ApmDataDumper> data_dumper_;
+ const size_t min_echo_path_delay_;
const size_t default_delay_;
size_t delay_;
+ EchoPathDelayEstimator delay_estimator_;
size_t blocks_since_last_delay_estimate_ = 300000;
int echo_path_delay_samples_;
size_t align_call_counter_ = 0;
@@ -50,7 +52,6 @@
std::vector<float> capture_delay_buffer_;
int capture_delay_buffer_index_ = 0;
RenderDelayControllerMetrics metrics_;
- EchoPathDelayEstimator delay_estimator_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RenderDelayControllerImpl);
};
@@ -78,12 +79,15 @@
int sample_rate_hz)
: data_dumper_(
new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))),
+ min_echo_path_delay_(config.delay.min_echo_path_delay_blocks),
default_delay_(
- std::max(config.delay.default_delay, kMinEchoPathDelayBlocks)),
+ std::max(config.delay.default_delay, min_echo_path_delay_)),
delay_(default_delay_),
+ delay_estimator_(data_dumper_.get(), config),
echo_path_delay_samples_(default_delay_ * kBlockSize),
- capture_delay_buffer_(kBlockSize * (kMaxApiCallsJitterBlocks + 2), 0.f),
- delay_estimator_(data_dumper_.get(), config) {
+ capture_delay_buffer_(
+ kBlockSize * (config.delay.api_call_jitter_blocks + 2),
+ 0.f) {
RTC_DCHECK(ValidFullBandRate(sample_rate_hz));
delay_estimator_.LogDelayEstimationProperties(sample_rate_hz,
capture_delay_buffer_.size());