chromium/media/capture/content/animated_content_sampler.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.

#include "media/capture/content/animated_content_sampler.h"

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

#include <algorithm>

#include "base/containers/adapters.h"

namespace media {

namespace {

// These specify the minimum/maximum amount of recent event history to examine
// to detect animated content.  If the values are too low, there is a greater
// risk of false-positive detections and low accuracy.  If they are too high,
// the the implementation will be slow to lock-in/out, and also will not react
// well to mildly-variable frame rate content (e.g., 25 +/- 1 FPS).
//
// These values were established by experimenting with a wide variety of
// scenarios, including 24/25/30 FPS videos, 60 FPS WebGL demos, and the
// transitions between static and animated content.
constexpr auto kMinObservationWindow =;
constexpr auto kMaxObservationWindow =;

// The maximum amount of time that can elapse before declaring two subsequent
// events as "not animating."  This is the same value found in
// cc::FrameRateCounter.
constexpr auto kNonAnimatingThreshold =;

// The slowest that content can be animating in order for AnimatedContentSampler
// to lock-in.  This is the threshold at which the "smoothness" problem is no
// longer relevant.
constexpr auto kMaxLockInPeriod =;

// The amount of time over which to fully correct the drift of the rewritten
// frame timestamps from the presentation event timestamps.  The lower the
// value, the higher the variance in frame timestamps.
constexpr auto kDriftCorrection =;

}  // anonymous namespace

AnimatedContentSampler::AnimatedContentSampler(
    base::TimeDelta min_capture_period)
    :{}

AnimatedContentSampler::~AnimatedContentSampler() = default;

void AnimatedContentSampler::SetMinCapturePeriod(base::TimeDelta period) {}

void AnimatedContentSampler::SetTargetSamplingPeriod(base::TimeDelta period) {}

void AnimatedContentSampler::ConsiderPresentationEvent(
    const gfx::Rect& damage_rect,
    base::TimeTicks event_time) {}

bool AnimatedContentSampler::HasProposal() const {}

bool AnimatedContentSampler::ShouldSample() const {}

void AnimatedContentSampler::RecordSample(base::TimeTicks frame_timestamp) {}

void AnimatedContentSampler::AddObservation(const gfx::Rect& damage_rect,
                                            base::TimeTicks event_time) {}

gfx::Rect AnimatedContentSampler::ElectMajorityDamageRect() const {}

bool AnimatedContentSampler::AnalyzeObservations(
    base::TimeTicks event_time,
    gfx::Rect* rect,
    base::TimeDelta* period) const {}

base::TimeTicks AnimatedContentSampler::ComputeNextFrameTimestamp(
    base::TimeTicks event_time) const {}

// static
base::TimeDelta AnimatedContentSampler::ComputeSamplingPeriod(
    base::TimeDelta animation_period,
    base::TimeDelta target_sampling_period,
    base::TimeDelta min_capture_period) {}

}  // namespace media