Single PSSH entitlement handling

[ Merge of http://go/wvgerrit/78425 ]

This CL refactors code, corrects comments and adds additional
integration tests.

Bug: 128462397
Test: WV unit/integration tests, GPlay playback tests and GtsMediaDrmTests
Change-Id: I679960d44c45cf4ff13c27eb960e66ec63f491b5
This commit is contained in:
Rahul Frias
2019-05-07 23:06:24 -07:00
parent 3b9b77c7c7
commit da25bce428
3 changed files with 163 additions and 22 deletions

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.