chromium/media/filters/video_renderer_algorithm_unittest.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/filters/video_renderer_algorithm.h"

#include <stddef.h>
#include <stdint.h>

#include <cmath>
#include <tuple>

#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/strings/stringprintf.h"
#include "base/test/simple_test_tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "media/base/media_util.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame_pool.h"
#include "media/base/wall_clock_time_source.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace media {

// Slows down the given |fps| according to NTSC field reduction standards; see
// http://en.wikipedia.org/wiki/Frame_rate#Digital_video_and_television
static double NTSC(double fps) {}

// Helper class for generating TimeTicks in a sequence according to a frequency.
class TickGenerator {};

class VideoRendererAlgorithmTest : public testing::Test {};

TEST_F(VideoRendererAlgorithmTest, Empty) {}

TEST_F(VideoRendererAlgorithmTest, Reset) {}

TEST_F(VideoRendererAlgorithmTest, AccountForMissingIntervals) {}

TEST_F(VideoRendererAlgorithmTest, OnLastFrameDropped) {}

TEST_F(VideoRendererAlgorithmTest, OnLastFrameDroppedFirstFrame) {}

TEST_F(VideoRendererAlgorithmTest, EffectiveFramesQueued) {}

TEST_F(VideoRendererAlgorithmTest, EffectiveFramesQueuedWithoutCadence) {}

TEST_F(VideoRendererAlgorithmTest, EffectiveFramesQueuedWithoutFrameDropping) {}

// The maximum acceptable drift should be updated once we have two frames.
TEST_F(VideoRendererAlgorithmTest, AcceptableDriftUpdated) {}

// Verifies behavior when time stops.
TEST_F(VideoRendererAlgorithmTest, TimeIsStopped) {}

// Verify frames inserted out of order end up in the right spot and are rendered
// according to the API contract.
TEST_F(VideoRendererAlgorithmTest, SortedFrameQueue) {}

// Run through integer cadence selection for 1, 2, 3, and 4.
TEST_F(VideoRendererAlgorithmTest, BestFrameByCadence) {}

TEST_F(VideoRendererAlgorithmTest, BestFrameByCadenceOverdisplayed) {}

TEST_F(VideoRendererAlgorithmTest, BestFrameByCadenceOverdisplayedForDrift) {}

TEST_F(VideoRendererAlgorithmTest, BestFrameByCoverage) {}

TEST_F(VideoRendererAlgorithmTest, BestFrameByDriftAndDriftCalculations) {}

// Run through fractional cadence selection for 1/2, 1/3, and 1/4.
TEST_F(VideoRendererAlgorithmTest, BestFrameByFractionalCadence) {}

// Verify a 3:2 frame pattern for 23.974fps and 24fps in 60Hz.
TEST_F(VideoRendererAlgorithmTest, FilmCadence) {}

// Spot check common display and frame rate pairs for correctness.
TEST_F(VideoRendererAlgorithmTest, CadenceCalculations) {}

TEST_F(VideoRendererAlgorithmTest, RemoveExpiredFramesWithoutRendering) {}

TEST_F(VideoRendererAlgorithmTest, RemoveExpiredFrames) {}

TEST_F(VideoRendererAlgorithmTest, RemoveExpiredFramesPartialReset) {}

TEST_F(VideoRendererAlgorithmTest, RemoveExpiredFramesCadence) {}

TEST_F(VideoRendererAlgorithmTest, RemoveExpiredFramesFractionalCadence) {}

class VideoRendererAlgorithmCadenceTest
    : public VideoRendererAlgorithmTest,
      public ::testing::WithParamInterface<::testing::tuple<double, double>> {};

TEST_P(VideoRendererAlgorithmCadenceTest, CadenceTest) {}

// Common display rates.
const double kDisplayRates[] =;

// List of common frame rate values. Values pulled from local test media,
// videostack test matrix, and Wikipedia.
const double kTestRates[] =;

INSTANTIATE_TEST_SUITE_P();

// Rotate through various playback rates and ensure algorithm adapts correctly.
TEST_F(VideoRendererAlgorithmTest, VariablePlaybackRateCadence) {}

// Ensures media which only expresses timestamps in milliseconds, gets the right
// cadence detection.
TEST_F(VideoRendererAlgorithmTest, UglyTimestampsHaveCadence) {}

// Ensures media with variable frame rate should not be applied with Cadence.
TEST_F(VideoRendererAlgorithmTest, VariableFrameRateNoCadence) {}

TEST_F(VideoRendererAlgorithmTest, EnqueueFrames) {}

TEST_F(VideoRendererAlgorithmTest, CadenceForFutureFrames) {}

TEST_F(VideoRendererAlgorithmTest, InfiniteDurationMetadata) {}

TEST_F(VideoRendererAlgorithmTest, UsesFrameDuration) {}

// Check that VideoRendererAlgorithm correctly sets WALLCLOCK_FRAME_DURATION
// for each frame.
TEST_F(VideoRendererAlgorithmTest, WallClockDurationMetadataSet) {}

}  // namespace media