// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_TREES_FRAME_RATE_ESTIMATOR_H_ #define CC_TREES_FRAME_RATE_ESTIMATOR_H_ #include <cstdint> #include "base/task/sequenced_task_runner.h" #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" #include "cc/base/delayed_unique_notifier.h" #include "cc/cc_export.h" namespace cc { // The class is used to decide the preferred begin frame rate which related // compositor frame sink should send based on video conference mode, // NotifyInputEvent, WillDraw and DidNotProduceFrame. It will enter // InputPriorityMode in the next 250ms(kInputPriorityDelay) if // NotifyInputEvent() is called and exit after the delay. Throttling is // disabled in InputPriorityMode despite other conditions. // 1. In video conference mode(features::kReducedFrameRateEstimation, enabled by // default): // The frame rate will be throttled to half of the default when: // Video conference mode is set and // the last drawn consecutive_frames_with_min_delta_ < // 4(kMinNumOfFramesWithMinDelta). // The throttling will be stopped when: // Video conference mode is unset or // the last drawn consecutive_frames_with_min_delta_ >= 4. // 2. In consecutive didNotProduceFrame // mode(features::kThrottleFrameRateOnManyDidNotProduceFrame): // The frame rate will be throttled to half of the default when: // The num_did_not_produce_frame_since_last_draw_ > // 4(kNumDidNotProduceFrameBeforeThrottle). // The throttling will be stopped when: // There's a drawn frame. class CC_EXPORT FrameRateEstimator { … }; } // namespace cc #endif // CC_TREES_FRAME_RATE_ESTIMATOR_H_