blob: 22528c948922a80cdb94fc364a40a78a8abb2fe7 [file] [log] [blame]
Gustaf Ullberg777cf262018-11-22 16:02:34 +01001/*
2 * Copyright (c) 2018 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_CLOCKDRIFT_DETECTOR_H_
12#define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
13
14#include <array>
15
16namespace webrtc {
17
18class ApmDataDumper;
19struct DownsampledRenderBuffer;
20struct EchoCanceller3Config;
21
22// Detects clockdrift by analyzing the estimated delay.
23class ClockdriftDetector {
24 public:
25 enum class Level { kNone, kProbable, kVerified, kNumCategories };
26 ClockdriftDetector();
27 ~ClockdriftDetector();
28 void Update(int delay_estimate);
29 Level ClockdriftLevel() const { return level_; }
30
31 private:
32 std::array<int, 3> delay_history_;
33 Level level_;
34 size_t stability_counter_;
35};
36} // namespace webrtc
37
38#endif // MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_