Update fallback policy for fast fallback. am: 28b45c4f1b am: 596363ef9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16096533 Change-Id: Ifd8e70f097345d9d17f2c96e7bdd0415fea62ca5
This commit is contained in:
@@ -22,13 +22,14 @@ static constexpr int64_t kSecondsPerDay = kSecondsPerHour * 24;
|
||||
// Initial backoff duration. Subsequent backoff durations for the
|
||||
// same engine will double its previous duration.
|
||||
static constexpr int64_t kAverageInitialBackoffDuration = kSecondsPerDay;
|
||||
static constexpr int64_t kInitalBackoffDurationDelta = kSecondsPerHour * 12;
|
||||
static constexpr int64_t kFastBackoffDuration = 30; // 30 seconds.
|
||||
static constexpr int64_t kInitialBackoffDurationDelta = kSecondsPerHour * 12;
|
||||
// Minimum backoff duration which an device will be required to
|
||||
// backoff the first time.
|
||||
static constexpr int64_t kMinInitialBackoffDuration =
|
||||
kAverageInitialBackoffDuration - kInitalBackoffDurationDelta;
|
||||
kAverageInitialBackoffDuration - kInitialBackoffDurationDelta;
|
||||
static constexpr int64_t kMaxInitialBackoffDuration =
|
||||
kAverageInitialBackoffDuration + kInitalBackoffDurationDelta;
|
||||
kAverageInitialBackoffDuration + kInitialBackoffDurationDelta;
|
||||
|
||||
// SystemFallbackPolicy is a centralized OKP state manager which allows
|
||||
// multiple CDM engines to communicate between each other. In a production
|
||||
@@ -70,6 +71,9 @@ class SystemFallbackPolicy {
|
||||
bool IsProvisioned();
|
||||
bool IsInFallbackMode();
|
||||
|
||||
void SetDefaultBackoffDurationRules();
|
||||
void SetFastBackoffDurationRules();
|
||||
|
||||
~SystemFallbackPolicy();
|
||||
|
||||
private:
|
||||
@@ -81,6 +85,8 @@ class SystemFallbackPolicy {
|
||||
|
||||
void StoreInfo();
|
||||
|
||||
int64_t GenerateInitialBackoffDuration();
|
||||
|
||||
int64_t GetSecondsSinceBackoffStart() const;
|
||||
void EndBackoffPeriod();
|
||||
|
||||
@@ -93,6 +99,10 @@ class SystemFallbackPolicy {
|
||||
|
||||
SystemFallbackInfo info_;
|
||||
|
||||
// When |fast_fallback_| is true, falling back only lasts a few
|
||||
// seconds, and exponential backoff is disabled.
|
||||
bool fast_fallback_ = false;
|
||||
|
||||
// Handle for the DeviceFiles instance used to store the OKP
|
||||
// information.
|
||||
// Not set for test instances.
|
||||
|
||||
@@ -45,6 +45,7 @@ class SystemFallbackInfo {
|
||||
backoff_duration_ = (duration > 0 ? duration : 0);
|
||||
}
|
||||
void DoubleBackoffDuration() { backoff_duration_ *= 2; }
|
||||
void ClearBackoffDuration() { backoff_duration_ = 0; }
|
||||
|
||||
bool HasProvisioningTime() const { return provisioning_time_ != 0; }
|
||||
int64_t provisioning_time() const { return provisioning_time_; }
|
||||
|
||||
Reference in New Issue
Block a user