blob: a90ccb024ba724f5534cbcaa0dbc9e57d88ac96e [file] [log] [blame]
peah69221db2017-01-27 03:28:19 -08001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
12#define MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
peah69221db2017-01-27 03:28:19 -080013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "api/array_view.h"
15#include "api/optional.h"
16#include "modules/audio_processing/aec3/downsampled_render_buffer.h"
17#include "modules/audio_processing/aec3/render_delay_buffer.h"
18#include "modules/audio_processing/include/audio_processing.h"
19#include "modules/audio_processing/logging/apm_data_dumper.h"
peah69221db2017-01-27 03:28:19 -080020
21namespace webrtc {
22
23// Class for aligning the render and capture signal using a RenderDelayBuffer.
24class RenderDelayController {
25 public:
Gustaf Ullbergbd83b912017-10-18 12:32:42 +020026 static RenderDelayController* Create(const EchoCanceller3Config& config,
Per Åhgrenc59a5762017-12-11 21:34:19 +010027 int non_causal_offset,
Gustaf Ullbergbd83b912017-10-18 12:32:42 +020028 int sample_rate_hz);
peah69221db2017-01-27 03:28:19 -080029 virtual ~RenderDelayController() = default;
30
peahcf02cf12017-04-05 14:18:07 -070031 // Resets the delay controller.
32 virtual void Reset() = 0;
peah69221db2017-01-27 03:28:19 -080033
peahcf02cf12017-04-05 14:18:07 -070034 // Receives the externally used delay.
35 virtual void SetDelay(size_t render_delay) = 0;
36
37 // Aligns the render buffer content with the capture signal.
Per Åhgrenc59a5762017-12-11 21:34:19 +010038 virtual rtc::Optional<size_t> GetDelay(
39 const DownsampledRenderBuffer& render_buffer,
40 rtc::ArrayView<const float> capture) = 0;
peah69221db2017-01-27 03:28:19 -080041};
42} // namespace webrtc
43
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020044#endif // MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_