123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #ifndef COMMON_VIDEO_FRAME_RATE_ESTIMATOR_H_
- #define COMMON_VIDEO_FRAME_RATE_ESTIMATOR_H_
- #include <deque>
- #include "absl/types/optional.h"
- #include "api/units/time_delta.h"
- #include "api/units/timestamp.h"
- namespace webrtc {
- class FrameRateEstimator {
- public:
- explicit FrameRateEstimator(TimeDelta averaging_window);
-
-
- void OnFrame(Timestamp time);
-
- absl::optional<double> GetAverageFps() const;
-
- absl::optional<double> GetAverageFps(Timestamp now);
-
- void Reset();
- private:
- void CullOld(Timestamp now);
- const TimeDelta averaging_window_;
- std::deque<Timestamp> frame_times_;
- };
- }
- #endif
|