Remove the headroom and delay estimation feedback loop in AEC3
This CL ensures that the external audio buffer delay is correctly used by removing the applied headroom and avoiding that the delay estimation feedback fromt the echo remover overrules the external delay information. Bug: webrtc:9241,chromium:839860 Change-Id: I53cc78ace34a71994ab24a3b552f29979e2aae78 Reviewed-on: https://webrtc-review.googlesource.com/75513 Reviewed-by: Gustaf Ullberg <gustaf@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23189}
This commit is contained in:
@ -74,7 +74,8 @@ class EchoRemoverImpl final : public EchoRemover {
|
||||
|
||||
// Returns the internal delay estimate in blocks.
|
||||
rtc::Optional<int> Delay() const override {
|
||||
return aec_state_.InternalDelay();
|
||||
// TODO(peah): Remove or reactivate this functionality.
|
||||
return rtc::nullopt;
|
||||
}
|
||||
|
||||
// Updates the status on whether echo leakage is detected in the output of the
|
||||
|
||||
@ -25,10 +25,16 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace {
|
||||
|
||||
bool EnableZeroExternalDelayHeadroom() {
|
||||
return !field_trial::IsEnabled(
|
||||
"WebRTC-Aec3ZeroExternalDelayHeadroomKillSwitch");
|
||||
}
|
||||
|
||||
class RenderDelayBufferImpl final : public RenderDelayBuffer {
|
||||
public:
|
||||
RenderDelayBufferImpl(const EchoCanceller3Config& config, size_t num_bands);
|
||||
@ -57,6 +63,7 @@ class RenderDelayBufferImpl final : public RenderDelayBuffer {
|
||||
std::unique_ptr<ApmDataDumper> data_dumper_;
|
||||
const Aec3Optimization optimization_;
|
||||
const EchoCanceller3Config config_;
|
||||
const bool use_zero_external_delay_headroom_;
|
||||
const int sub_block_size_;
|
||||
MatrixBuffer blocks_;
|
||||
VectorBuffer spectra_;
|
||||
@ -161,6 +168,7 @@ RenderDelayBufferImpl::RenderDelayBufferImpl(const EchoCanceller3Config& config,
|
||||
new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))),
|
||||
optimization_(DetectOptimization()),
|
||||
config_(config),
|
||||
use_zero_external_delay_headroom_(EnableZeroExternalDelayHeadroom()),
|
||||
sub_block_size_(
|
||||
static_cast<int>(config.delay.down_sampling_factor > 0
|
||||
? kBlockSize / config.delay.down_sampling_factor
|
||||
@ -203,12 +211,12 @@ void RenderDelayBufferImpl::Reset() {
|
||||
|
||||
// Check for any external audio buffer delay and whether it is feasible.
|
||||
if (external_audio_buffer_delay_) {
|
||||
constexpr size_t kHeadroom = 2;
|
||||
const size_t headroom = use_zero_external_delay_headroom_ ? 0 : 2;
|
||||
size_t external_delay_to_set = 0;
|
||||
if (*external_audio_buffer_delay_ < kHeadroom) {
|
||||
if (*external_audio_buffer_delay_ < headroom) {
|
||||
external_delay_to_set = 0;
|
||||
} else {
|
||||
external_delay_to_set = *external_audio_buffer_delay_ - kHeadroom;
|
||||
external_delay_to_set = *external_audio_buffer_delay_ - headroom;
|
||||
}
|
||||
|
||||
external_delay_to_set = std::min(external_delay_to_set, MaxDelay());
|
||||
|
||||
Reference in New Issue
Block a user