blob: 2ba90bb88905c7200a6aa2965612bef3a702d810 [file] [log] [blame]
Gustaf Ullberg777cf262018-11-22 15:02:341/*
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
Stephan Hartmann3ca28362020-05-31 09:01:3814#include <stddef.h>
15
Gustaf Ullberg777cf262018-11-22 15:02:3416#include <array>
17
18namespace webrtc {
19
20class ApmDataDumper;
21struct DownsampledRenderBuffer;
22struct EchoCanceller3Config;
23
24// Detects clockdrift by analyzing the estimated delay.
25class ClockdriftDetector {
26 public:
27 enum class Level { kNone, kProbable, kVerified, kNumCategories };
28 ClockdriftDetector();
29 ~ClockdriftDetector();
30 void Update(int delay_estimate);
31 Level ClockdriftLevel() const { return level_; }
32
33 private:
34 std::array<int, 3> delay_history_;
35 Level level_;
36 size_t stability_counter_;
37};
38} // namespace webrtc
39
40#endif // MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_