Use 0 to represent unexpired license in OnExpirationUpdate
Also fix a missing change for "playback duration should override license duration". Merged from Widevine CDM repo: https://widevine-internal-review.googlesource.com/#/c/14435/ Bug: 21393975 Change-Id: Ibfcf3ae4c13db8944ea285bcc79b6312ea621e1b
This commit is contained in:
@@ -66,13 +66,6 @@ class PolicyEngine {
|
||||
|
||||
virtual const LicenseIdentification& license_id() { return license_id_; }
|
||||
|
||||
bool IsLicenseDurationExpired(int64_t current_time) {
|
||||
return GetLicenseExpiryTime() <= current_time;
|
||||
}
|
||||
bool IsPlaybackDurationExpired(int64_t current_time) {
|
||||
return GetPlaybackExpiryTime() <= current_time;
|
||||
}
|
||||
|
||||
bool GetSecondsSinceStarted(int64_t* seconds_since_started);
|
||||
bool GetSecondsSinceLastPlayed(int64_t* seconds_since_started);
|
||||
|
||||
@@ -85,6 +78,8 @@ class PolicyEngine {
|
||||
bool IsLicenseForFuture() { return license_state_ == kLicenseStatePending; }
|
||||
bool IsPlaybackStarted() { return playback_start_time_ > 0; }
|
||||
|
||||
bool IsLicenseOrPlaybackDurationExpired(int64_t current_time);
|
||||
|
||||
private:
|
||||
friend class PolicyEngineTest;
|
||||
|
||||
@@ -139,6 +134,7 @@ class PolicyEngine {
|
||||
int64_t playback_start_time_;
|
||||
int64_t last_playback_time_;
|
||||
int64_t last_expiry_time_;
|
||||
bool last_expiry_time_set_;
|
||||
|
||||
// This is used as a reference point for policy management. This value
|
||||
// represents an offset from license_start_time_. This is used to
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#ifndef WVCDM_CORE_WV_CDM_CONSTANTS_H_
|
||||
#define WVCDM_CORE_WV_CDM_CONSTANTS_H_
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -16,7 +14,9 @@ static const size_t KEY_SIZE = 16;
|
||||
static const size_t MAC_KEY_SIZE = 32;
|
||||
static const size_t KEYBOX_KEY_DATA_SIZE = 72;
|
||||
|
||||
static const int64_t NEVER_EXPIRES = LLONG_MAX;
|
||||
// Use 0 to represent never expired license as specified in EME spec
|
||||
// (NaN in JS translates to 0 in unix timestamp).
|
||||
static const int64_t NEVER_EXPIRES = 0;
|
||||
|
||||
static const char SESSION_ID_PREFIX[] = "sid";
|
||||
static const char KEY_SET_ID_PREFIX[] = "ksid";
|
||||
|
||||
@@ -17,6 +17,8 @@ class WvCdmEventListener {
|
||||
virtual void OnSessionKeysChange(const CdmSessionId& session_id,
|
||||
const CdmKeyStatusMap& keys_status,
|
||||
bool has_new_usable_key) = 0;
|
||||
// Note that a |new_expiry_time_seconds| of 0 represents never expired
|
||||
// license.
|
||||
virtual void OnExpirationUpdate(const CdmSessionId& session_id,
|
||||
int64_t new_expiry_time_seconds) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user