clockdrift_detector.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  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. #ifndef MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
  11. #define MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_
  12. #include <stddef.h>
  13. #include <array>
  14. namespace webrtc {
  15. class ApmDataDumper;
  16. struct DownsampledRenderBuffer;
  17. struct EchoCanceller3Config;
  18. // Detects clockdrift by analyzing the estimated delay.
  19. class ClockdriftDetector {
  20. public:
  21. enum class Level { kNone, kProbable, kVerified, kNumCategories };
  22. ClockdriftDetector();
  23. ~ClockdriftDetector();
  24. void Update(int delay_estimate);
  25. Level ClockdriftLevel() const { return level_; }
  26. private:
  27. std::array<int, 3> delay_history_;
  28. Level level_;
  29. size_t stability_counter_;
  30. };
  31. } // namespace webrtc
  32. #endif // MODULES_AUDIO_PROCESSING_AEC3_CLOCKDRIFT_DETECTOR_H_