Allow Reloading Partially-Released Licenses

(This is a merge of http://go/wvgerrit/62780)

The EME spec requires that it be possible to do the following flow:

  1) Generate a release request for a persistent session.
  2) Close the session.
  3) Load the persistent session.
  4) Update the session with the release response.

This flow is used by Netflix in their API as well. However, our code did
not support this flow, as it rejected attempts to reload
partially-released sessions.

This patch changes attempts to load sessions that have already had
release messages generated into release-retry reloads, allowing them to
be released.

Bug: 113167010
Test: CE CDM Unit Tests
Test: Android CDM Unit Tests
Change-Id: I75bb7c75911e0fad1584bd8dd27f83c17f73bf45
This commit is contained in:
John W. Bruce
2018-10-09 14:07:13 -07:00
parent 3d603eb12d
commit 5d4932264f
2 changed files with 10 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ class CdmSession {
WvCdmEventListener* event_listener);
virtual CdmResponseType RestoreOfflineSession(
const CdmKeySetId& key_set_id, const CdmLicenseType license_type);
const CdmKeySetId& key_set_id, CdmLicenseType license_type);
virtual CdmResponseType RestoreUsageSession(
const DeviceFiles::CdmUsageData& usage_data);

View File

@@ -186,7 +186,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
}
CdmResponseType CdmSession::RestoreOfflineSession(
const CdmKeySetId& key_set_id, const CdmLicenseType license_type) {
const CdmKeySetId& key_set_id, CdmLicenseType license_type) {
if (!initialized_) {
LOGE("CdmSession::RestoreOfflineSession: not initialized");
return NOT_INITIALIZED_ERROR;
@@ -214,7 +214,14 @@ CdmResponseType CdmSession::RestoreOfflineSession(
return GET_LICENSE_ERROR;
}
// Do not restore a released offline license, unless a release retry
// Attempts to restore a released offline license are treated as a release
// retry.
if (license_state == DeviceFiles::kLicenseStateReleasing) {
license_type = kLicenseTypeRelease;
}
// Only restore offline licenses if they are active or this is a release
// retry.
if (!(license_type == kLicenseTypeRelease ||
license_state == DeviceFiles::kLicenseStateActive)) {
LOGE(