Corrections for limited duration licenses

[ Merge of http://go/wvgerrit/74627 ]

Limited duration licenses (where license duration is unlimited and
playback window is set to a small value) did not work correctly when
the initial decrypt call occured before the license was received.

Bug: 109653883
Test: WV unit/integration tests
Change-Id: I0738e97db525b239455e2ac93ab0bedd6611b311
This commit is contained in:
Rahul Frias
2019-03-14 17:36:38 -07:00
parent a5bc8be7a0
commit 43efc6d84a
5 changed files with 132 additions and 7 deletions

View File

@@ -231,7 +231,7 @@ void PolicyEngine::UpdateLicense(const License& license) {
NotifyExpirationUpdate(current_time);
}
void PolicyEngine::BeginDecryption() {
bool PolicyEngine::BeginDecryption() {
if (playback_start_time_ == 0) {
switch (license_state_) {
case kLicenseStateCanPlay:
@@ -246,14 +246,17 @@ void PolicyEngine::BeginDecryption() {
license_state_ = kLicenseStateNeedRenewal;
}
NotifyExpirationUpdate(playback_start_time_);
break;
return true;
case kLicenseStateInitial:
case kLicenseStatePending:
case kLicenseStateExpired:
default:
break;
return false;
}
}
else {
return true;
}
}
void PolicyEngine::DecryptionEvent() { last_playback_time_ = GetCurrentTime(); }