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:
John "Juce" Bruce
2014-10-30 23:38:48 -07:00
parent b3650a9661
commit 12821d5968
14 changed files with 748 additions and 99 deletions

View File

@@ -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(