Allow PSSH data to be unspecified on license renewal
Currently the CDM requires the caller to specify init data both on key generation and renewal requests. With this change the CDM relaxes this requirement for renewals. Bug: 8732893 Merge of https://widevine-internal-review.googlesource.com/#/c/5322/ from Widevine CDM repo Change-Id: Idf4ad2bdb20023da4f30bc369ed87eb811c1c4d9
This commit is contained in:
@@ -96,6 +96,11 @@ class CdmEngine : public TimerHandler {
|
||||
WvCdmEventListener* listener);
|
||||
bool DetachEventListener(const CdmSessionId& session_id,
|
||||
WvCdmEventListener* listener);
|
||||
|
||||
// Parse a blob of multiple concatenated PSSH atoms to extract the first
|
||||
// widevine pssh
|
||||
static bool ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
CdmInitData* output);
|
||||
private:
|
||||
// private methods
|
||||
// Cancel all sessions
|
||||
@@ -104,11 +109,6 @@ class CdmEngine : public TimerHandler {
|
||||
void ComposeJsonRequest(const std::string& message,
|
||||
CdmProvisioningRequest* request);
|
||||
|
||||
// Parse a blob of multiple concatenated PSSH atoms to extract the first
|
||||
// widevine pssh
|
||||
// TODO(gmorgan): This should be done by the user of this class.
|
||||
bool ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
CdmInitData* output);
|
||||
bool ParseJsonResponse(const CdmProvisioningResponse& json_str,
|
||||
const std::string& start_substr,
|
||||
const std::string& end_substr,
|
||||
|
||||
@@ -33,7 +33,7 @@ class CdmSession {
|
||||
bool VerifySession(const CdmKeySystem& key_system,
|
||||
const CdmInitData& init_data);
|
||||
|
||||
CdmResponseType GenerateKeyRequest(const CdmInitData& pssh_data,
|
||||
CdmResponseType GenerateKeyRequest(const CdmInitData& init_data,
|
||||
const CdmLicenseType license_type,
|
||||
CdmAppParameterMap& app_parameters,
|
||||
CdmKeyMessage* key_request,
|
||||
|
||||
@@ -127,26 +127,15 @@ CdmResponseType CdmEngine::GenerateKeyRequest(
|
||||
// TODO(edwinwong, rfrias): validate key_system has not changed
|
||||
}
|
||||
|
||||
if (init_data.empty()) {
|
||||
LOGE("CdmEngine::GenerateKeyRequest: no init_data provided");
|
||||
return KEY_ERROR;
|
||||
}
|
||||
|
||||
if (!key_request) {
|
||||
LOGE("CdmEngine::GenerateKeyRequest: no key request destination provided");
|
||||
return KEY_ERROR;
|
||||
}
|
||||
|
||||
CdmInitData extracted_pssh;
|
||||
if (!ExtractWidevinePssh(init_data, &extracted_pssh)) {
|
||||
key_request->clear();
|
||||
return KEY_ERROR;
|
||||
}
|
||||
|
||||
key_request->clear();
|
||||
|
||||
// TODO(edwinwong, rfrias): need to pass in license type and app parameters
|
||||
CdmResponseType sts = iter->second->GenerateKeyRequest(extracted_pssh,
|
||||
CdmResponseType sts = iter->second->GenerateKeyRequest(init_data,
|
||||
license_type,
|
||||
app_parameters,
|
||||
key_request,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "clock.h"
|
||||
#include "cdm_engine.h"
|
||||
#include "crypto_engine.h"
|
||||
#include "device_files.h"
|
||||
#include "log.h"
|
||||
@@ -62,7 +63,7 @@ bool CdmSession::VerifySession(const CdmKeySystem& key_system,
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
const CdmInitData& pssh_data,
|
||||
const CdmInitData& init_data,
|
||||
const CdmLicenseType license_type,
|
||||
CdmAppParameterMap& app_parameters,
|
||||
CdmKeyMessage* key_request,
|
||||
@@ -83,6 +84,11 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
server_url);
|
||||
}
|
||||
else {
|
||||
CdmInitData pssh_data;
|
||||
if (!CdmEngine::ExtractWidevinePssh(init_data, &pssh_data)) {
|
||||
return KEY_ERROR;
|
||||
}
|
||||
|
||||
if (Properties::use_certificates_as_identification()) {
|
||||
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_))
|
||||
return NEED_PROVISIONING;
|
||||
|
||||
@@ -62,9 +62,10 @@ class WvCdmRequestLicenseTest : public testing::Test {
|
||||
}
|
||||
|
||||
void GenerateRenewalRequest(const std::string& key_system,
|
||||
const std::string& init_data) {
|
||||
const std::string& not_used) {
|
||||
// TODO application makes a license request, CDM will renew the license
|
||||
// when appropriate.
|
||||
std::string init_data;
|
||||
wvcdm::CdmAppParameterMap app_parameters;
|
||||
std::string server_url;
|
||||
EXPECT_EQ(decryptor_.GenerateKeyRequest(session_id_,
|
||||
|
||||
Reference in New Issue
Block a user