am 6e4896e8: Merge "Corrections to license policy handling and reporting" into lmp-mr1-dev

* commit '6e4896e8ba52192a731eab19f454a1f51544dbab':
  Corrections to license policy handling and reporting
This commit is contained in:
Rahul Frias
2015-01-17 11:46:40 +00:00
committed by Android Git Automerger
2 changed files with 87 additions and 10 deletions

View File

@@ -163,15 +163,14 @@ void PolicyEngine::UpdateLicense(
policy_max_duration_seconds_ = policy_.license_duration_seconds();
}
if (!policy_.can_play()) {
int64_t current_time = clock_->GetCurrentTime();
if (!policy_.can_play() ||
IsLicenseDurationExpired(current_time) ||
IsPlaybackDurationExpired(current_time)) {
license_state_ = kLicenseStateExpired;
return;
}
int64_t current_time = clock_->GetCurrentTime();
if (IsLicenseDurationExpired(current_time)) return;
if (IsPlaybackDurationExpired(current_time)) return;
// Update state
if (current_time >= license_start_time_) {
license_state_ = kLicenseStateCanPlay;
@@ -216,8 +215,10 @@ CdmResponseType PolicyEngine::Query(CdmQueryMap* key_info) {
std::stringstream ss;
int64_t current_time = clock_->GetCurrentTime();
if (license_state_ == kLicenseStateInitial)
return UNKNOWN_ERROR;
if (license_state_ == kLicenseStateInitial) {
key_info->clear();
return NO_ERROR;
}
(*key_info)[QUERY_KEY_LICENSE_TYPE] =
license_id_.type() == video_widevine_server::sdk::STREAMING ?