• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
11 #ifndef MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
12 #define MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
13 
14 #include "absl/types/optional.h"
15 #include "api/array_view.h"
16 #include "api/audio/echo_canceller3_config.h"
17 #include "modules/audio_processing/aec3/delay_estimate.h"
18 #include "modules/audio_processing/aec3/downsampled_render_buffer.h"
19 #include "modules/audio_processing/aec3/render_delay_buffer.h"
20 #include "modules/audio_processing/logging/apm_data_dumper.h"
21 
22 namespace webrtc {
23 
24 // Class for aligning the render and capture signal using a RenderDelayBuffer.
25 class RenderDelayController {
26  public:
27   static RenderDelayController* Create(const EchoCanceller3Config& config,
28                                        int sample_rate_hz,
29                                        size_t num_capture_channels);
30   virtual ~RenderDelayController() = default;
31 
32   // Resets the delay controller. If the delay confidence is reset, the reset
33   // behavior is as if the call is restarted.
34   virtual void Reset(bool reset_delay_confidence) = 0;
35 
36   // Logs a render call.
37   virtual void LogRenderCall() = 0;
38 
39   // Aligns the render buffer content with the capture signal.
40   virtual absl::optional<DelayEstimate> GetDelay(
41       const DownsampledRenderBuffer& render_buffer,
42       size_t render_delay_buffer_delay,
43       const std::vector<std::vector<float>>& capture) = 0;
44 
45   // Returns true if clockdrift has been detected.
46   virtual bool HasClockdrift() const = 0;
47 };
48 }  // namespace webrtc
49 
50 #endif  // MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_CONTROLLER_H_
51