Add Max-Res Decode Engine to CDM Core
(This is a port of http://go/wvgerrit/11555 from the Widevine CDM repo.) Bug: 16034599 Change-Id: Ie69afac7d89e27623adbc84d2baebccf1d1ba6e6
This commit is contained in:
@@ -16,11 +16,13 @@
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
PolicyEngine::PolicyEngine() {
|
||||
PolicyEngine::PolicyEngine(CryptoSession* crypto_session)
|
||||
: max_res_engine_(crypto_session) {
|
||||
Init(new Clock());
|
||||
}
|
||||
|
||||
PolicyEngine::PolicyEngine(Clock* clock) {
|
||||
PolicyEngine::PolicyEngine(CryptoSession* crypto_session, Clock* clock)
|
||||
: max_res_engine_(crypto_session) {
|
||||
Init(clock);
|
||||
}
|
||||
|
||||
@@ -40,6 +42,10 @@ void PolicyEngine::Init(Clock* clock) {
|
||||
clock_ = clock;
|
||||
}
|
||||
|
||||
bool PolicyEngine::CanDecrypt(const KeyId& key_id) {
|
||||
return can_decrypt_ && max_res_engine_.CanDecrypt(key_id);
|
||||
}
|
||||
|
||||
void PolicyEngine::OnTimerEvent(bool* event_occurred, CdmEventType* event) {
|
||||
*event_occurred = false;
|
||||
int64_t current_time = clock_->GetCurrentTime();
|
||||
@@ -101,6 +107,8 @@ void PolicyEngine::OnTimerEvent(bool* event_occurred, CdmEventType* event) {
|
||||
*event = LICENSE_RENEWAL_NEEDED_EVENT;
|
||||
*event_occurred = true;
|
||||
}
|
||||
|
||||
max_res_engine_.OnTimerEvent();
|
||||
}
|
||||
|
||||
void PolicyEngine::SetLicense(
|
||||
@@ -109,6 +117,7 @@ void PolicyEngine::SetLicense(
|
||||
license_id_.CopyFrom(license.id());
|
||||
policy_.Clear();
|
||||
UpdateLicense(license);
|
||||
max_res_engine_.SetLicense(license);
|
||||
}
|
||||
|
||||
void PolicyEngine::UpdateLicense(
|
||||
|
||||
Reference in New Issue
Block a user