chromium/media/capture/content/video_capture_oracle.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/capture/content/video_capture_oracle.h"

#include <algorithm>
#include <limits>
#include <utility>

#include "base/compiler_specific.h"
#include "base/format_macros.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"

namespace media {

namespace {

// When a non-compositor event arrives after animation has halted, this
// controls how much time must elapse before deciding to allow a capture.
constexpr auto kAnimationHaltPeriodBeforeCaptureAllowed =;

// When estimating frame durations, this is the hard upper-bound on the
// estimate.
constexpr auto kUpperBoundsDurationEstimate =;

// The half-life of data points provided to the accumulator used when evaluating
// the recent utilization of the buffer pool.  This value is based on a
// simulation, and reacts quickly to change to avoid depleting the buffer pool
// (which would cause hard frame drops).
constexpr auto kBufferUtilizationEvaluationInterval =;

// The half-life of data points provided to the accumulator used when evaluating
// the recent resource utilization of the consumer.  The trade-off made here is
// reaction time versus over-reacting to outlier data points.
constexpr auto kConsumerCapabilityEvaluationInterval =;

// The maximum amount of time that may elapse without a feedback update.  Any
// longer, and currently-accumulated feedback is not considered recent enough to
// base decisions off of.  This prevents changes to the capture size when there
// is an unexpected pause in events.
constexpr auto kMaxTimeSinceLastFeedbackUpdate =;

// The amount of additional time, since content animation was last detected, to
// continue being extra-careful about increasing the capture size.  This is used
// to prevent brief periods of non-animating content from throwing off the
// heuristics that decide whether to increase the capture size.
constexpr auto kDebouncingPeriodForAnimatedContent =;

// When content is animating, this is the length of time the system must be
// contiguously under-utilized before increasing the capture size.
constexpr auto kProvingPeriodForAnimatedContent =;

// Given the amount of time between frames, compare to the expected amount of
// time between frames at |frame_rate| and return the fractional difference.
double FractionFromExpectedFrameRate(base::TimeDelta delta, int frame_rate) {}

// Returns the next-higher TimeTicks value.
base::TimeTicks JustAfter(base::TimeTicks t) {}

}  // anonymous namespace

// static
constexpr base::TimeDelta VideoCaptureOracle::kDefaultMinCapturePeriod;

// static
constexpr base::TimeDelta VideoCaptureOracle::kDefaultMinSizeChangePeriod;

VideoCaptureOracle::VideoCaptureOracle(bool enable_auto_throttling)
    :{}

VideoCaptureOracle::~VideoCaptureOracle() = default;

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

void VideoCaptureOracle::SetCaptureSizeConstraints(
    const gfx::Size& min_size,
    const gfx::Size& max_size,
    bool use_fixed_aspect_ratio) {}

void VideoCaptureOracle::SetAutoThrottlingEnabled(bool enabled) {}

void VideoCaptureOracle::SetSourceSize(const gfx::Size& source_size) {}

bool VideoCaptureOracle::ObserveEventAndDecideCapture(
    Event event,
    const gfx::Rect& damage_rect,
    base::TimeTicks event_time) {}

void VideoCaptureOracle::RecordCapture(float pool_utilization) {}

void VideoCaptureOracle::RecordWillNotCapture(float pool_utilization) {}

bool VideoCaptureOracle::CompleteCapture(int frame_number,
                                         bool capture_was_successful,
                                         base::TimeTicks* frame_timestamp) {}

void VideoCaptureOracle::CancelAllCaptures() {}

void VideoCaptureOracle::RecordConsumerFeedback(
    int frame_number,
    const media::VideoCaptureFeedback& feedback) {}

void VideoCaptureOracle::SetMinSizeChangePeriod(base::TimeDelta period) {}

gfx::Size VideoCaptureOracle::capture_size() const {}

// static
const char* VideoCaptureOracle::EventAsString(Event event) {}

base::TimeTicks VideoCaptureOracle::GetFrameTimestamp(int frame_number) const {}

void VideoCaptureOracle::SetFrameTimestamp(int frame_number,
                                           base::TimeTicks timestamp) {}

NOINLINE bool VideoCaptureOracle::IsFrameInRecentHistory(
    int frame_number) const {}

void VideoCaptureOracle::CommitCaptureSizeAndReset(
    base::TimeTicks last_frame_time) {}

void VideoCaptureOracle::AnalyzeAndAdjust(const base::TimeTicks analyze_time) {}

int VideoCaptureOracle::AnalyzeForDecreasedArea(base::TimeTicks analyze_time) {}

int VideoCaptureOracle::AnalyzeForIncreasedArea(base::TimeTicks analyze_time) {}

base::TimeDelta
VideoCaptureOracle::GetExplorationPeriodAfterSourceSizeChange() {}

bool VideoCaptureOracle::HasSufficientRecentFeedback(
    const FeedbackSignalAccumulator<base::TimeTicks>& accumulator,
    base::TimeTicks now) {}

void VideoCaptureOracle::SetLogCallback(
    base::RepeatingCallback<void(const std::string&)> emit_log_cb) {}

}  // namespace media