Source release v2.1.6-0-824 + third_party libs
Change-Id: If190f81154326aa7dc22d66009687f389146ddfd
This commit is contained in:
@@ -14,6 +14,18 @@
|
||||
#include "wv_cdm_types.h"
|
||||
#include "wv_cdm_version.h"
|
||||
|
||||
namespace {
|
||||
enum {
|
||||
// individual error codes
|
||||
kAttachEventListenerError = 0x0001,
|
||||
|
||||
// error classes to be OR'd with cdm engine result values
|
||||
kOpenSessionErrorBase = 0x0100,
|
||||
kGenerateKeyRequestErrorBase = 0x0200,
|
||||
kAddKeyErrorBase = 0x0300,
|
||||
};
|
||||
} // namespace
|
||||
|
||||
void INITIALIZE_CDM_MODULE() {}
|
||||
|
||||
void DeinitializeCdmModule() {}
|
||||
@@ -115,15 +127,20 @@ cdm::Status WvContentDecryptionModule::GenerateKeyRequest(
|
||||
CdmResponseType result =
|
||||
cdm_engine_.OpenSession("com.widevine.alpha", &property_set_, &session_id);
|
||||
|
||||
if (NEED_PROVISIONING == result) {
|
||||
if (result == NEED_PROVISIONING) {
|
||||
LOGI("Need to aquire a Device Certificate from the Provisioning Server");
|
||||
return cdm::kNeedsDeviceCertificate;
|
||||
}
|
||||
|
||||
if (NO_ERROR != result) return cdm::kSessionError;
|
||||
if (result != NO_ERROR) {
|
||||
host_->SendKeyError("", 0, cdm::kClientError,
|
||||
kOpenSessionErrorBase | result);
|
||||
return cdm::kSessionError;
|
||||
}
|
||||
|
||||
if (!cdm_engine_.AttachEventListener(session_id, &host_event_listener_)) {
|
||||
cdm_engine_.CloseSession(session_id);
|
||||
host_->SendKeyError("", 0, cdm::kClientError, kAttachEventListenerError);
|
||||
return cdm::kSessionError;
|
||||
}
|
||||
|
||||
@@ -136,13 +153,14 @@ cdm::Status WvContentDecryptionModule::GenerateKeyRequest(
|
||||
app_parameters, &key_request, &server_url);
|
||||
if (KEY_MESSAGE != result) {
|
||||
cdm_engine_.CloseSession(session_id);
|
||||
host_->SendKeyError("", 0, cdm::kClientError,
|
||||
kGenerateKeyRequestErrorBase | result);
|
||||
return cdm::kSessionError;
|
||||
}
|
||||
|
||||
host_->SendKeyMessage(session_id.data(), session_id.length(),
|
||||
key_request.data(), key_request.length(),
|
||||
server_url.data(), server_url.length());
|
||||
|
||||
return cdm::kSuccess;
|
||||
}
|
||||
|
||||
@@ -162,9 +180,11 @@ cdm::Status WvContentDecryptionModule::AddKey(const char* session_id,
|
||||
if (response == KEY_ADDED) {
|
||||
EnablePolicyTimer();
|
||||
return cdm::kSuccess;
|
||||
} else {
|
||||
return cdm::kSessionError;
|
||||
}
|
||||
|
||||
host_->SendKeyError(session_id, session_id_size, cdm::kClientError,
|
||||
kAddKeyErrorBase | response);
|
||||
return cdm::kSessionError;
|
||||
}
|
||||
|
||||
bool WvContentDecryptionModule::IsKeyValid(const uint8_t* key_id,
|
||||
@@ -173,11 +193,11 @@ bool WvContentDecryptionModule::IsKeyValid(const uint8_t* key_id,
|
||||
return cdm_engine_.IsKeyLoaded(key);
|
||||
}
|
||||
|
||||
cdm::Status WvContentDecryptionModule::CancelKeyRequest(const char* session_id,
|
||||
int session_id_size) {
|
||||
LOGI("WvContentDecryptionModule::CancelKeyRequest()");
|
||||
cdm::Status WvContentDecryptionModule::CloseSession(const char* session_id,
|
||||
int session_id_size) {
|
||||
LOGI("WvContentDecryptionModule::CloseSession()");
|
||||
CdmSessionId session_id_internal(session_id, session_id_size);
|
||||
return cdm_engine_.CancelKeyRequest(session_id_internal) == NO_ERROR
|
||||
return cdm_engine_.CloseSession(session_id_internal) == NO_ERROR
|
||||
? cdm::kSuccess
|
||||
: cdm::kSessionError;
|
||||
}
|
||||
@@ -196,6 +216,7 @@ cdm::Status WvContentDecryptionModule::Decrypt(
|
||||
LOGI("WvContentDecryptionModule::Decrypt()");
|
||||
if (static_cast<size_t>(encrypted_buffer.iv_size) != KEY_IV_SIZE)
|
||||
return cdm::kDecryptError;
|
||||
|
||||
std::vector < uint8_t > iv(KEY_IV_SIZE);
|
||||
memcpy(&iv[0], encrypted_buffer.iv, encrypted_buffer.iv_size);
|
||||
|
||||
@@ -204,9 +225,9 @@ cdm::Status WvContentDecryptionModule::Decrypt(
|
||||
|
||||
CdmSessionId session_id; // it's empty but cdm_engine will locate via key_id?
|
||||
|
||||
if (NULL == encrypted_buffer.subsamples
|
||||
|| encrypted_buffer.num_subsamples <= 0)
|
||||
return cdm::kDecryptError;
|
||||
if (!encrypted_buffer.subsamples ||
|
||||
encrypted_buffer.num_subsamples <= 0)
|
||||
return cdm::kDecryptError;
|
||||
|
||||
CdmDecryptionParameters parameters(&key_id,
|
||||
encrypted_buffer.data, 0, &iv, 0,
|
||||
@@ -236,8 +257,8 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderFrame(
|
||||
encrypted_buffer.key_id_size);
|
||||
CdmSessionId session_id; // it's empty but cdm_engine will locate via key_id.
|
||||
|
||||
if (NULL == encrypted_buffer.subsamples
|
||||
|| encrypted_buffer.num_subsamples <= 0)
|
||||
if (!encrypted_buffer.subsamples ||
|
||||
encrypted_buffer.num_subsamples <= 0)
|
||||
return cdm::kDecryptError;
|
||||
|
||||
CdmDecryptionParameters parameters(&key_id, encrypted_buffer.data, 0, &iv, 0,
|
||||
@@ -262,7 +283,7 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderSamples(
|
||||
encrypted_buffer.key_id_size);
|
||||
CdmSessionId session_id; // it's empty but cdm_engine will locate via key_id.
|
||||
|
||||
if (NULL == encrypted_buffer.subsamples ||
|
||||
if (!encrypted_buffer.subsamples ||
|
||||
encrypted_buffer.num_subsamples <= 0)
|
||||
return cdm::kDecryptError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user