am 4bce2959: Allow PSSH data to be unspecified on license renewal
* commit '4bce2959efe276998a9b438ae890905918c7eb71': Allow PSSH data to be unspecified on license renewal
This commit is contained in:
@@ -96,6 +96,11 @@ class CdmEngine : public TimerHandler {
|
|||||||
WvCdmEventListener* listener);
|
WvCdmEventListener* listener);
|
||||||
bool DetachEventListener(const CdmSessionId& session_id,
|
bool DetachEventListener(const CdmSessionId& session_id,
|
||||||
WvCdmEventListener* listener);
|
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:
|
||||||
// private methods
|
// private methods
|
||||||
// Cancel all sessions
|
// Cancel all sessions
|
||||||
@@ -104,11 +109,6 @@ class CdmEngine : public TimerHandler {
|
|||||||
void ComposeJsonRequest(const std::string& message,
|
void ComposeJsonRequest(const std::string& message,
|
||||||
CdmProvisioningRequest* request);
|
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,
|
bool ParseJsonResponse(const CdmProvisioningResponse& json_str,
|
||||||
const std::string& start_substr,
|
const std::string& start_substr,
|
||||||
const std::string& end_substr,
|
const std::string& end_substr,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class CdmSession {
|
|||||||
bool VerifySession(const CdmKeySystem& key_system,
|
bool VerifySession(const CdmKeySystem& key_system,
|
||||||
const CdmInitData& init_data);
|
const CdmInitData& init_data);
|
||||||
|
|
||||||
CdmResponseType GenerateKeyRequest(const CdmInitData& pssh_data,
|
CdmResponseType GenerateKeyRequest(const CdmInitData& init_data,
|
||||||
const CdmLicenseType license_type,
|
const CdmLicenseType license_type,
|
||||||
CdmAppParameterMap& app_parameters,
|
CdmAppParameterMap& app_parameters,
|
||||||
CdmKeyMessage* key_request,
|
CdmKeyMessage* key_request,
|
||||||
|
|||||||
@@ -127,26 +127,15 @@ CdmResponseType CdmEngine::GenerateKeyRequest(
|
|||||||
// TODO(edwinwong, rfrias): validate key_system has not changed
|
// 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) {
|
if (!key_request) {
|
||||||
LOGE("CdmEngine::GenerateKeyRequest: no key request destination provided");
|
LOGE("CdmEngine::GenerateKeyRequest: no key request destination provided");
|
||||||
return KEY_ERROR;
|
return KEY_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmInitData extracted_pssh;
|
|
||||||
if (!ExtractWidevinePssh(init_data, &extracted_pssh)) {
|
|
||||||
key_request->clear();
|
|
||||||
return KEY_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
key_request->clear();
|
key_request->clear();
|
||||||
|
|
||||||
// TODO(edwinwong, rfrias): need to pass in license type and app parameters
|
// 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,
|
license_type,
|
||||||
app_parameters,
|
app_parameters,
|
||||||
key_request,
|
key_request,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
|
#include "cdm_engine.h"
|
||||||
#include "crypto_engine.h"
|
#include "crypto_engine.h"
|
||||||
#include "device_files.h"
|
#include "device_files.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@@ -62,7 +63,7 @@ bool CdmSession::VerifySession(const CdmKeySystem& key_system,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType CdmSession::GenerateKeyRequest(
|
CdmResponseType CdmSession::GenerateKeyRequest(
|
||||||
const CdmInitData& pssh_data,
|
const CdmInitData& init_data,
|
||||||
const CdmLicenseType license_type,
|
const CdmLicenseType license_type,
|
||||||
CdmAppParameterMap& app_parameters,
|
CdmAppParameterMap& app_parameters,
|
||||||
CdmKeyMessage* key_request,
|
CdmKeyMessage* key_request,
|
||||||
@@ -83,6 +84,11 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
|||||||
server_url);
|
server_url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
CdmInitData pssh_data;
|
||||||
|
if (!CdmEngine::ExtractWidevinePssh(init_data, &pssh_data)) {
|
||||||
|
return KEY_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
if (Properties::use_certificates_as_identification()) {
|
if (Properties::use_certificates_as_identification()) {
|
||||||
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_))
|
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_))
|
||||||
return NEED_PROVISIONING;
|
return NEED_PROVISIONING;
|
||||||
|
|||||||
@@ -62,9 +62,10 @@ class WvCdmRequestLicenseTest : public testing::Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GenerateRenewalRequest(const std::string& key_system,
|
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
|
// TODO application makes a license request, CDM will renew the license
|
||||||
// when appropriate.
|
// when appropriate.
|
||||||
|
std::string init_data;
|
||||||
wvcdm::CdmAppParameterMap app_parameters;
|
wvcdm::CdmAppParameterMap app_parameters;
|
||||||
std::string server_url;
|
std::string server_url;
|
||||||
EXPECT_EQ(decryptor_.GenerateKeyRequest(session_id_,
|
EXPECT_EQ(decryptor_.GenerateKeyRequest(session_id_,
|
||||||
|
|||||||
Reference in New Issue
Block a user