#include "media/filters/video_cadence_estimator.h"
#include <math.h>
#include <stddef.h>
#include <memory>
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "media/base/media_switches.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
constexpr auto kMinimumAcceptableTimeBetweenGlitches = …;
static double NTSC(double fps) { … }
static base::TimeDelta Interval(double hertz) { … }
std::vector<int> CreateCadenceFromString(const std::string& cadence) { … }
static void VerifyCadenceVectorWithCustomDeviationAndDrift(
VideoCadenceEstimator* estimator,
double frame_hertz,
double render_hertz,
base::TimeDelta deviation,
base::TimeDelta acceptable_drift,
const std::string& expected_cadence) { … }
static void VerifyCadenceVectorWithCustomDrift(
VideoCadenceEstimator* estimator,
double frame_hertz,
double render_hertz,
base::TimeDelta acceptable_drift,
const std::string& expected_cadence) { … }
static void VerifyCadenceVectorWithCustomDeviation(
VideoCadenceEstimator* estimator,
double frame_hertz,
double render_hertz,
base::TimeDelta deviation,
const std::string& expected_cadence) { … }
static void VerifyCadenceVector(VideoCadenceEstimator* estimator,
double frame_hertz,
double render_hertz,
const std::string& expected_cadence) { … }
TEST(VideoCadenceEstimatorTest, CadenceCalculations) { … }
TEST(VideoCadenceEstimatorTest, CadenceCalculationWithLargeDrift) { … }
TEST(VideoCadenceEstimatorTest, SimpleCadenceTest) { … }
TEST(VideoCadenceEstimatorTest, CadenceCalculationWithLargeDeviation) { … }
TEST(VideoCadenceEstimatorTest, CadenceVariesWithAcceptableDrift) { … }
TEST(VideoCadenceEstimatorTest, CadenceVariesWithAcceptableGlitchTime) { … }
TEST(VideoCadenceEstimatorTest, CadenceHystersisPreventsOscillation) { … }
TEST(VideoCadenceEstimatorTest, RenderIntervalChangingSkipsHystersis) { … }
void VerifyCadenceSequence(VideoCadenceEstimator* estimator,
double frame_rate,
double display_rate,
std::vector<int> expected_cadence) { … }
}