#include "modules/audio_processing/aec3/render_delay_controller.h"
#include <stddef.h>
#include <algorithm>
#include <atomic>
#include <memory>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/echo_canceller3_config.h"
#include "modules/audio_processing/aec3/aec3_common.h"
#include "modules/audio_processing/aec3/delay_estimate.h"
#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
#include "modules/audio_processing/aec3/echo_path_delay_estimator.h"
#include "modules/audio_processing/aec3/render_delay_controller_metrics.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/checks.h"
namespace webrtc {
namespace {
class RenderDelayControllerImpl final : public RenderDelayController { … };
DelayEstimate ComputeBufferDelay(
const absl::optional<DelayEstimate>& current_delay,
int hysteresis_limit_blocks,
DelayEstimate estimated_delay) { … }
std::atomic<int> RenderDelayControllerImpl::instance_count_(0);
RenderDelayControllerImpl::RenderDelayControllerImpl(
const EchoCanceller3Config& config,
int sample_rate_hz,
size_t num_capture_channels)
: … { … }
RenderDelayControllerImpl::~RenderDelayControllerImpl() = default;
void RenderDelayControllerImpl::Reset(bool reset_delay_confidence) { … }
void RenderDelayControllerImpl::LogRenderCall() { … }
absl::optional<DelayEstimate> RenderDelayControllerImpl::GetDelay(
const DownsampledRenderBuffer& render_buffer,
size_t render_delay_buffer_delay,
const Block& capture) { … }
bool RenderDelayControllerImpl::HasClockdrift() const { … }
}
RenderDelayController* RenderDelayController::Create(
const EchoCanceller3Config& config,
int sample_rate_hz,
size_t num_capture_channels) { … }
}