Source release 18.1.0
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -43,20 +44,45 @@ class PolicyTimers {
|
||||
// For offline save and restore
|
||||
virtual int64_t GetPlaybackStartTime() { return playback_start_time_; }
|
||||
virtual int64_t GetLastPlaybackTime() { return last_playback_time_; }
|
||||
virtual int64_t GetGracePeriodEndTime() = 0;
|
||||
// This is a legacy field for offline licenses. Since no grace period is
|
||||
// supported return a default value.
|
||||
virtual int64_t GetGracePeriodEndTime() { return 0; }
|
||||
virtual void RestorePlaybackTimes(int64_t current_time,
|
||||
int64_t playback_start_time,
|
||||
int64_t last_playback_time,
|
||||
int64_t grace_period_end_time) = 0;
|
||||
int64_t grace_period_end_time);
|
||||
|
||||
virtual bool HasPlaybackStarted(int64_t current_time) = 0;
|
||||
virtual bool HasPlaybackStarted(int64_t /* current_time */) {
|
||||
return playback_start_time_ != 0;
|
||||
}
|
||||
|
||||
// For licenses that support core messages, evaluation of only rental and
|
||||
// playback durations are needed.
|
||||
virtual bool HasLicenseOrRentalOrPlaybackDurationExpired(
|
||||
int64_t current_time) = 0;
|
||||
virtual bool HasPassedGracePeriod(int64_t current_time) = 0;
|
||||
int64_t current_time) {
|
||||
return HasRentalOrPlaybackDurationExpired(current_time);
|
||||
}
|
||||
virtual bool HasPassedGracePeriod(int64_t /* current_time */) { return true; }
|
||||
|
||||
// This returns
|
||||
// * before playback begins: the time remaining on |rental_duration_seconds|
|
||||
// * after playback begins:
|
||||
// - |soft_enforce_playback_duration| is true: the time remaining on
|
||||
// |playback_duration_seconds|
|
||||
// - |soft_enforce_playback_duration| is false: the minimum
|
||||
// of the time remaining on |rental_duration_seconds| or
|
||||
// |playback_duration_seconds|
|
||||
//
|
||||
// |license_duration_seconds| is ignored with the introduction of core
|
||||
// messages
|
||||
virtual int64_t GetLicenseOrRentalOrPlaybackDurationRemaining(
|
||||
int64_t current_time) = 0;
|
||||
virtual int64_t GetLicenseOrRentalDurationRemaining(int64_t current_time) = 0;
|
||||
int64_t current_time);
|
||||
// This is only used in Query. This should return the time remaining on
|
||||
// |rental_duration_seconds|.
|
||||
virtual int64_t GetLicenseOrRentalDurationRemaining(int64_t current_time) {
|
||||
return GetRentalDurationRemaining(current_time);
|
||||
};
|
||||
|
||||
// This is only used in Query. This should return |playback_duration_seconds|
|
||||
// before playback begins or the time remaining on
|
||||
// |playback_duration_seconds| after playback begins.
|
||||
@@ -72,7 +98,7 @@ class PolicyTimers {
|
||||
virtual bool UpdateExpirationTime(int64_t current_time, int64_t* expiry_time);
|
||||
|
||||
// Renewal related methods
|
||||
virtual bool HasRenewalDelayExpired(int64_t current_time);
|
||||
virtual bool HasRenewalDelayExpired(int64_t current_time) = 0;
|
||||
virtual bool HasRenewalRetryIntervalExpired(int64_t current_time);
|
||||
virtual void UpdateRenewalRequest(int64_t current_time);
|
||||
virtual bool HasRenewalRecoveryDurationExpired(int64_t current_time);
|
||||
@@ -90,11 +116,11 @@ class PolicyTimers {
|
||||
was_expired_on_load_(false) {}
|
||||
|
||||
// Gets the clock time that the license expires based on whether we have
|
||||
// started playing.
|
||||
// started playing. This takes into account GetHardLicenseExpiryTime.
|
||||
virtual int64_t GetExpiryTime(int64_t current_time,
|
||||
bool ignore_soft_enforce_playback_duration) = 0;
|
||||
|
||||
virtual int64_t GetRenewalStartTime() = 0;
|
||||
bool ignore_soft_enforce_playback_duration);
|
||||
virtual int64_t GetRentalExpiryTime(int64_t current_time);
|
||||
virtual int64_t GetRenewalStartTime() { return renewal_start_time_; }
|
||||
|
||||
// This is the current policy information for this license. This gets updated
|
||||
// as license renewals occur.
|
||||
@@ -105,12 +131,19 @@ class PolicyTimers {
|
||||
int64_t last_playback_time_;
|
||||
int64_t last_expiry_time_;
|
||||
int64_t last_expiry_time_set_;
|
||||
int64_t renewal_start_time_ = 0;
|
||||
int64_t next_renewal_time_;
|
||||
|
||||
// Indicates whether a persistent license was expired when loaded
|
||||
bool was_expired_on_load_;
|
||||
|
||||
private:
|
||||
// Gets the clock time that the rental duration or playback will expire.
|
||||
virtual int64_t GetPlaybackExpiryTime(
|
||||
int64_t current_time, bool ignore_soft_enforce_playback_duration);
|
||||
bool HasRentalOrPlaybackDurationExpired(int64_t current_time);
|
||||
virtual int64_t GetRentalDurationRemaining(int64_t current_time);
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(PolicyTimers);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user