Wrap Init Data in PSSH Box
The Java APIs only easily expose getting the PSSH data blob, not the full PSSH box. So that apps do not have to do extra work, wrapping the PSSH data blob in a PSSH box again, we do it for them in the DrmPlugin. Includes requisite changes to the Unit tests Bug: 8584241 Merge of https://widevine-internal-review.googlesource.com/#/c/5142/ from the Widevine CDM repository. Change-Id: Ifb5910dd52380e1b591ecdf1e4273c8d9f3294cc
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#include "WVDrmPlugin.h"
|
||||
|
||||
#include <endian.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -129,9 +130,24 @@ status_t WVDrmPlugin::getKeyRequest(
|
||||
} else {
|
||||
return android::ERROR_DRM_CANNOT_HANDLE;
|
||||
}
|
||||
|
||||
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
||||
CdmInitData cdmInitData(initData.begin(), initData.end());
|
||||
|
||||
// Build PSSH box for PSSH data in initData.
|
||||
static const char psshPrefix[] = {
|
||||
0, 0, 0, 0, // Total size
|
||||
'p', 's', 's', 'h', // "PSSH"
|
||||
0, 0, 0, 0, // Flags - must be zero
|
||||
0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, // Widevine UUID
|
||||
0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED,
|
||||
0, 0, 0, 0 // Size of initData
|
||||
};
|
||||
CdmInitData psshBox(psshPrefix, sizeof(psshPrefix) / sizeof(uint8_t));
|
||||
psshBox.append(reinterpret_cast<const char*>(initData.array()),
|
||||
initData.size());
|
||||
uint32_t* psshBoxSize = reinterpret_cast<uint32_t*>(&psshBox[0]);
|
||||
uint32_t* initDataSize = reinterpret_cast<uint32_t*>(&psshBox[28]);
|
||||
*initDataSize = htonl(initData.size());
|
||||
*psshBoxSize = htonl(psshBox.size());
|
||||
|
||||
CdmAppParameterMap cdmParameters;
|
||||
for (size_t i = 0; i < optionalParameters.size(); ++i) {
|
||||
@@ -147,7 +163,7 @@ status_t WVDrmPlugin::getKeyRequest(
|
||||
CdmKeyMessage keyRequest;
|
||||
string cdmDefaultUrl;
|
||||
|
||||
CdmResponseType res = mCDM->GenerateKeyRequest(cdmSessionId, cdmInitData,
|
||||
CdmResponseType res = mCDM->GenerateKeyRequest(cdmSessionId, psshBox,
|
||||
cdmLicenseType,
|
||||
cdmParameters, &keyRequest,
|
||||
&cdmDefaultUrl);
|
||||
|
||||
Reference in New Issue
Block a user