chromium/third_party/webrtc/common_video/frame_rate_estimator.h

/*
 *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#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 used to estimate a frame-rate using inter-frame intervals.
// Some notes on usage:
// This class is intended to accurately estimate the frame rate during a
// continuous stream. Unlike a traditional rate estimator that looks at number
// of data points within a time window, if the input stops this implementation
// will not smoothly fall down towards 0. This is done so that the estimated
// fps is not affected by edge conditions like if we sample just before or just
// after the next frame.
// To avoid problems if a stream is stopped and restarted (where estimated fps
// could look too low), users of this class should explicitly call Reset() on
// restart.
// Also note that this class is not thread safe, it's up to the user to guard
// against concurrent access.
class FrameRateEstimator {};

}  // namespace webrtc

#endif  // COMMON_VIDEO_FRAME_RATE_ESTIMATOR_H_