Refactor WvCdmEventListener and some cleanups
Bug: 19771437 It is a merge of below CLs from Widevine CDM repo: Clean up CdmSession and PolicyEngine testing injection https://widevine-internal-review.googlesource.com/#/c/13700 Refactor WvCdmEventListener handling https://widevine-internal-review.googlesource.com/#/c/13702 Change-Id: I356b90000c056113d394926862b859aab380d305
This commit is contained in:
@@ -17,29 +17,17 @@
|
||||
namespace wvcdm {
|
||||
|
||||
PolicyEngine::PolicyEngine(CryptoSession* crypto_session)
|
||||
: max_res_engine_(crypto_session) {
|
||||
Init(new Clock());
|
||||
}
|
||||
: license_state_(kLicenseStateInitial),
|
||||
can_decrypt_(false),
|
||||
license_start_time_(0),
|
||||
playback_start_time_(0),
|
||||
last_playback_time_(0),
|
||||
next_renewal_time_(0),
|
||||
policy_max_duration_seconds_(0),
|
||||
max_res_engine_(crypto_session),
|
||||
clock_(new Clock) {}
|
||||
|
||||
PolicyEngine::PolicyEngine(CryptoSession* crypto_session, Clock* clock)
|
||||
: max_res_engine_(crypto_session) {
|
||||
Init(clock);
|
||||
}
|
||||
|
||||
PolicyEngine::~PolicyEngine() {
|
||||
if (clock_) delete clock_;
|
||||
}
|
||||
|
||||
void PolicyEngine::Init(Clock* clock) {
|
||||
license_state_ = kLicenseStateInitial;
|
||||
can_decrypt_ = false;
|
||||
license_start_time_ = 0;
|
||||
playback_start_time_ = 0;
|
||||
last_playback_time_ = 0;
|
||||
next_renewal_time_ = 0;
|
||||
policy_max_duration_seconds_ = 0;
|
||||
clock_ = clock;
|
||||
}
|
||||
PolicyEngine::~PolicyEngine() {}
|
||||
|
||||
bool PolicyEngine::CanDecrypt(const KeyId& key_id) {
|
||||
return can_decrypt_ && max_res_engine_.CanDecrypt(key_id);
|
||||
@@ -316,4 +304,6 @@ bool PolicyEngine::IsRenewalRetryIntervalExpired(int64_t current_time) {
|
||||
next_renewal_time_ <= current_time;
|
||||
}
|
||||
|
||||
void PolicyEngine::set_clock(Clock* clock) { clock_.reset(clock); }
|
||||
|
||||
} // wvcdm
|
||||
|
||||
Reference in New Issue
Block a user