Merge "Playback duration should override license duration" into mnc-dev
This commit is contained in:
@@ -49,8 +49,8 @@ void PolicyEngine::OnTimerEvent() {
|
||||
int64_t current_time = clock_->GetCurrentTime();
|
||||
|
||||
// License expiration trumps all.
|
||||
if ((IsLicenseDurationExpired(current_time) ||
|
||||
IsPlaybackDurationExpired(current_time)) &&
|
||||
if ((IsPlaybackDurationExpired(current_time) ||
|
||||
(IsLicenseDurationExpired(current_time) && !IsPlaybackStarted())) &&
|
||||
license_state_ != kLicenseStateExpired) {
|
||||
license_state_ = kLicenseStateExpired;
|
||||
NotifyKeysChange(kKeyStatusExpired);
|
||||
@@ -164,8 +164,8 @@ void PolicyEngine::UpdateLicense(const License& license) {
|
||||
}
|
||||
|
||||
int64_t current_time = clock_->GetCurrentTime();
|
||||
if (!policy_.can_play() || IsLicenseDurationExpired(current_time) ||
|
||||
IsPlaybackDurationExpired(current_time)) {
|
||||
if (!policy_.can_play() || IsPlaybackDurationExpired(current_time) ||
|
||||
(IsLicenseDurationExpired(current_time) && !IsPlaybackStarted())) {
|
||||
license_state_ = kLicenseStateExpired;
|
||||
NotifyKeysChange(kKeyStatusExpired);
|
||||
return;
|
||||
@@ -348,8 +348,9 @@ void PolicyEngine::NotifyKeysChange(CdmKeyStatus new_status) {
|
||||
}
|
||||
|
||||
void PolicyEngine::NotifyExpirationUpdate() {
|
||||
int64_t expiry_time =
|
||||
std::min(GetLicenseExpiryTime(), GetPlaybackExpiryTime());
|
||||
int64_t expiry_time = IsPlaybackStarted() ? GetPlaybackExpiryTime()
|
||||
: std::min(GetLicenseExpiryTime(),
|
||||
GetPlaybackExpiryTime());
|
||||
if (expiry_time != last_expiry_time_) {
|
||||
last_expiry_time_ = expiry_time;
|
||||
if (event_listener_)
|
||||
|
||||
Reference in New Issue
Block a user