#ifdef UNSAFE_BUFFERS_BUILD
#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 {
constexpr auto kAnimationHaltPeriodBeforeCaptureAllowed = …;
constexpr auto kUpperBoundsDurationEstimate = …;
constexpr auto kBufferUtilizationEvaluationInterval = …;
constexpr auto kConsumerCapabilityEvaluationInterval = …;
constexpr auto kMaxTimeSinceLastFeedbackUpdate = …;
constexpr auto kDebouncingPeriodForAnimatedContent = …;
constexpr auto kProvingPeriodForAnimatedContent = …;
double FractionFromExpectedFrameRate(base::TimeDelta delta, int frame_rate) { … }
base::TimeTicks JustAfter(base::TimeTicks t) { … }
}
constexpr base::TimeDelta VideoCaptureOracle::kDefaultMinCapturePeriod;
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 { … }
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) { … }
}