Merge "Single PSSH entitlement handling" into qt-dev

This commit is contained in:
Rahul Frias
2019-05-13 16:26:16 +00:00
committed by Android (Google) Code Review
3 changed files with 163 additions and 22 deletions

View File

@@ -425,10 +425,12 @@ CdmResponseType CdmSession::GenerateKeyRequestInternal(
case kLicenseTypeRelease:
is_release_ = true;
break;
// TODO(jfore): CdmSession assumes a call to this method once a license has
// been received is a call to generate a license renewal message. Use of
// this enum differentiates the two calls. See "else if (license_received_)"
// below.
// TODO(b/132071885): Once a license has been received, CdmSession assumes
// that a call to this method is to generate a license renewal/release
// or key rotation. Key rotation can be indicated by specifing a license
// type kLicenseTypeEmbeddedKeyData or interrogating the PSSH
// (See "else if (license_received_)" below). b/132071885 is to evaluate
// whether both mechanisms are needed.
case kLicenseTypeEmbeddedKeyData:
return license_parser_->HandleEmbeddedKeyData(init_data);
default:
@@ -441,7 +443,7 @@ CdmResponseType CdmSession::GenerateKeyRequestInternal(
return GenerateReleaseRequest(key_request);
} else if (license_received_) {
// A call to GenerateKeyRequest after the initial license has been received
// is either a renewal request or a key rotation event
// is either a renewal/release request or a key rotation event
if (init_data.contains_entitled_keys())
return license_parser_->HandleEmbeddedKeyData(init_data);
else

View File

@@ -126,10 +126,9 @@ bool InitializationData::SelectWidevinePssh(const CdmInitData& init_data,
return false;
}
// If there are multiple PSSHs to choose from and this device prefers
// entitlements, find the first |ENTITLED_KEY| PSSH, if present, and
// select it.
if (prefer_entitlements && pssh_payloads.size() > 1) {
// If this device prefers entitlements, search through available PSSHs.
// If present, select the first |ENTITLED_KEY| PSSH.
if (prefer_entitlements && !pssh_payloads.empty()) {
for (size_t i = 0; i < pssh_payloads.size(); ++i) {
WidevinePsshData pssh;
if (!pssh.ParseFromString(pssh_payloads[i])) {
@@ -146,12 +145,6 @@ bool InitializationData::SelectWidevinePssh(const CdmInitData& init_data,
}
}
WidevinePsshData pssh;
if (prefer_entitlements && pssh.ParseFromString(pssh_payloads[0])) {
if (pssh.type() == WidevinePsshData_Type_ENTITLED_KEY)
contains_entitled_keys_ = true;
}
// Either there is only one PSSH, this device does not prefer entitlements,
// or no entitlement PSSH was found. Regardless of how we got here, select the
// first PSSH, which should be a |SINGLE| PSSH.