Merge Tweaks Originating in Merge Review Comments

This merges several small changes that were made in response to
comments that arose when LMP changes were merged into the Widevine
repository's master branch.

Change-Id: Ifec968af54dbc3288f24654ec0c6ca9b5962e1aa
This commit is contained in:
John "Juce" Bruce
2015-03-10 15:22:11 -07:00
parent fb6d83398c
commit 1bd405fc40
11 changed files with 32 additions and 52 deletions

View File

@@ -72,7 +72,7 @@ void CdmSession::Create(CdmLicense* license_parser,
is_initial_usage_update_ = true;
is_usage_update_needed_ = false;
is_initial_decryption_ = true;
has_decrypted_recently_ = false;
has_decrypted_since_last_report_ = false;
if (cdm_client_property_set) {
Properties::AddSessionPropertySet(session_id_, cdm_client_property_set);
}
@@ -340,6 +340,8 @@ CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
if (crypto_session_.get() == NULL || !crypto_session_->IsOpen())
return UNKNOWN_ERROR;
// Playback may not begin until either the start time passes or the license
// is updated, so we treat this Decrypt call as invalid and return KEY_ERROR.
if (params.is_encrypted && !policy_engine_->CanDecrypt(*params.key_id)) {
return policy_engine_->IsLicenseForFuture() ? KEY_ERROR : NEED_KEY;
}
@@ -352,7 +354,7 @@ CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
policy_engine_->BeginDecryption();
is_initial_decryption_ = false;
}
has_decrypted_recently_ = true;
has_decrypted_since_last_report_ = true;
if (!is_usage_update_needed_) {
is_usage_update_needed_ =
!license_parser_->provider_session_token().empty();
@@ -368,9 +370,6 @@ CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
}
break;
}
default: { //Ignore
break;
}
}
return status;
@@ -557,9 +556,9 @@ void CdmSession::OnTimerEvent(bool update_usage) {
bool event_occurred = false;
CdmEventType event;
if (update_usage && has_decrypted_recently_) {
if (update_usage && has_decrypted_since_last_report_) {
policy_engine_->DecryptionEvent();
has_decrypted_recently_ = false;
has_decrypted_since_last_report_ = false;
if (is_offline_ && !is_release_) {
StoreLicense(DeviceFiles::kLicenseStateActive);
}