Implement Method to Release Licenses Without a Server Roundtrip

Merge from Widevine repo of http://go/wvgerrit/52480

Partners have asked for a way to release offline licenses without
using a release message. This is typically used by cable partners who
are caching licenses ahead of time and do not care about usage
statistics.

As part of implementing this request, CdmSession::DeleteLicense() was
renamed to reflect that it only deletes the *files* associated with a
license, and a new CdmSession::DeleteLicense() has been written that
also cleans up other related data.

Bug: 77955334
Test: CE CDM Unit Tests
Test: tested as part of http://go/ag/4674759
Change-Id: I00d6e20935c5fecb3ac9be6757c0f191d85c6bd6
This commit is contained in:
Fred Gylys-Colwell
2018-06-30 23:08:55 -07:00
parent 240652afcf
commit a242a32bba
8 changed files with 53 additions and 18 deletions

View File

@@ -715,16 +715,7 @@ CdmResponseType CdmSession::ReleaseKey(const CdmKeyResponse& key_response) {
if (sts != KEY_ADDED) return (sts == KEY_ERROR) ? RELEASE_KEY_ERROR : sts;
if (is_offline_ || has_provider_session_token()) {
DeleteLicense();
if (usage_support_type_ == kUsageEntrySupport &&
has_provider_session_token()) {
sts = DeleteUsageEntry(usage_entry_number_);
if (NO_ERROR != sts) return sts;
}
}
return NO_ERROR;
return RemoveLicense();
}
CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
@@ -897,9 +888,21 @@ CdmResponseType CdmSession::RemoveKeys() {
return NO_ERROR;
}
bool CdmSession::DeleteLicense() {
if (!is_offline_ && !has_provider_session_token())
return false;
CdmResponseType CdmSession::RemoveLicense() {
if (is_offline_ || has_provider_session_token()) {
DeleteLicenseFile();
if (usage_support_type_ == kUsageEntrySupport &&
has_provider_session_token()) {
CdmResponseType sts = DeleteUsageEntry(usage_entry_number_);
if (NO_ERROR != sts) return sts;
}
}
return NO_ERROR;
}
bool CdmSession::DeleteLicenseFile() {
if (!is_offline_ && !has_provider_session_token()) return false;
if (is_offline_) {
return file_handle_->DeleteLicense(key_set_id_);