Merge changes I5271f961,I8a75d2e1 into sc-widevine-release
* changes: Added debugOtaKeyboxFallbackDuration property. Update fallback policy for fast fallback.
This commit is contained in:
committed by
Android (Google) Code Review
commit
bc62a6f3fe
@@ -360,6 +360,16 @@ class CdmEngine {
|
||||
virtual void SetUserId(uint32_t user_id) { user_id_ = user_id; }
|
||||
virtual uint32_t GetUserId() const { return user_id_; }
|
||||
|
||||
// Changes the rules used for calculating the fallback duration
|
||||
// when OTA keybox provisioning fails.
|
||||
// Default rules use fallback duration measured in days, with exponential
|
||||
// backoff.
|
||||
// Fast rules use fallback durations of a few seconds, without exponential
|
||||
// backoff.
|
||||
// This method has no effect if OTA keybox is not required.
|
||||
virtual void SetDefaultOtaKeyboxFallbackDurationRules();
|
||||
virtual void SetFastOtaKeyboxFallbackDurationRules();
|
||||
|
||||
protected:
|
||||
friend class CdmEngineFactory;
|
||||
|
||||
|
||||
@@ -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