blob: ca0cbea05303dc4c8a7a4dcd8676e89d4cd498c5 [file] [log] [blame]
Sergey Silkinae3144c2018-08-29 01:05:26 +02001/*
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
Åsa Persson062acd92021-08-16 09:33:13 +020011#ifndef MODULES_VIDEO_CODING_UTILITY_FRAMERATE_CONTROLLER_DEPRECATED_H_
12#define MODULES_VIDEO_CODING_UTILITY_FRAMERATE_CONTROLLER_DEPRECATED_H_
Sergey Silkinae3144c2018-08-29 01:05:26 +020013
Yves Gerey3e707812018-11-28 16:47:49 +010014#include <stdint.h>
15
Sergey Silkinae3144c2018-08-29 01:05:26 +020016#include "absl/types/optional.h"
17#include "rtc_base/rate_statistics.h"
18
19namespace webrtc {
20
Åsa Persson062acd92021-08-16 09:33:13 +020021// Please use webrtc::FramerateController instead.
22class FramerateControllerDeprecated {
Sergey Silkinae3144c2018-08-29 01:05:26 +020023 public:
Åsa Persson062acd92021-08-16 09:33:13 +020024 explicit FramerateControllerDeprecated(float target_framerate_fps);
Sergey Silkinae3144c2018-08-29 01:05:26 +020025
26 void SetTargetRate(float target_framerate_fps);
27 float GetTargetRate();
28
29 // Advices user to drop next frame in order to reach target framerate.
30 bool DropFrame(uint32_t timestamp_ms) const;
31
32 void AddFrame(uint32_t timestamp_ms);
33
34 void Reset();
35
36 private:
37 absl::optional<float> Rate(uint32_t timestamp_ms) const;
38
39 absl::optional<float> target_framerate_fps_;
40 absl::optional<uint32_t> last_timestamp_ms_;
41 uint32_t min_frame_interval_ms_;
42 RateStatistics framerate_estimator_;
43};
44
45} // namespace webrtc
46
Åsa Persson062acd92021-08-16 09:33:13 +020047#endif // MODULES_VIDEO_CODING_UTILITY_FRAMERATE_CONTROLLER_DEPRECATED_H_