Source release v2.1.1-0-738 + third_party libs
Change-Id: I76e298f8092951d4214c776d6bbcad6b763eb5b2
This commit is contained in:
@@ -111,27 +111,27 @@ bool File::Remove(const std::string& path) {
|
||||
}
|
||||
|
||||
bool File::Copy(const std::string& from, const std::string& to) {
|
||||
// Required for linkage only - no current API implementation in the partner CDM is required.
|
||||
// Required for linkage only - no API implementation is needed by the CDM
|
||||
return false;
|
||||
}
|
||||
|
||||
bool File::List(const std::string& path, std::vector<std::string>* files) {
|
||||
// Required for linkage only - no current API implementation in the partner CDM is required.
|
||||
// Required for linkage only - no API implementation is needed by the CDM
|
||||
return false;
|
||||
}
|
||||
|
||||
bool File::CreateDirectory(std::string path) {
|
||||
// Required for linkage only - no current API implementation in the partner CDM is required.
|
||||
// Required for linkage only - no API implementation is needed by the CDM
|
||||
return true;
|
||||
}
|
||||
|
||||
bool File::IsDirectory(const std::string& path) {
|
||||
// Required for linkage only - no current API implementation in the partner CDM is required.
|
||||
// Required for linkage only - no API implementation is needed by the CDM
|
||||
return false;
|
||||
}
|
||||
|
||||
bool File::IsRegularFile(const std::string& path) {
|
||||
// Required for linkage only - no current API implementation in the partner CDM is required.
|
||||
// Required for linkage only - no API implementation is needed by the CDM
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "cdm_client_property_set.h"
|
||||
#include "content_decryption_module.h"
|
||||
#include "initialization_data.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
@@ -89,6 +90,8 @@ cdm::Status WvContentDecryptionModule::GenerateKeyRequest(
|
||||
LOGI("Enter WvContentDecryptionModule::GenerateKeyRequest()");
|
||||
CdmInitData init_data_internal(reinterpret_cast<const char*>(init_data),
|
||||
init_data_size);
|
||||
InitializationData initialization_data(ISO_BMFF_VIDEO_MIME_TYPE,
|
||||
init_data_internal);
|
||||
CdmKeyMessage key_request;
|
||||
CdmSessionId session_id;
|
||||
|
||||
@@ -124,7 +127,7 @@ cdm::Status WvContentDecryptionModule::GenerateKeyRequest(
|
||||
std::string server_url;
|
||||
|
||||
result = cdm_engine_.GenerateKeyRequest(
|
||||
session_id, key_set_id, init_data_internal, kLicenseTypeStreaming,
|
||||
session_id, key_set_id, initialization_data, kLicenseTypeStreaming,
|
||||
app_parameters, &key_request, &server_url);
|
||||
if (KEY_MESSAGE != result) {
|
||||
cdm_engine_.CloseSession(session_id);
|
||||
@@ -182,7 +185,7 @@ cdm::Status WvContentDecryptionModule::Decrypt(
|
||||
const cdm::InputBuffer& encrypted_buffer,
|
||||
cdm::DecryptedBlock* decrypted_block) {
|
||||
LOGI("=>Enter WvContentDecryptionModule::Decrypt()\n");
|
||||
if (encrypted_buffer.iv_size != KEY_IV_SIZE)
|
||||
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);
|
||||
@@ -199,9 +202,9 @@ cdm::Status WvContentDecryptionModule::Decrypt(
|
||||
CdmDecryptionParameters parameters(&key_id,
|
||||
encrypted_buffer.data, 0, &iv, 0,
|
||||
NULL);
|
||||
parameters.is_secure = false;
|
||||
return DoSubsampleDecrypt(session_id,
|
||||
parameters,
|
||||
parameters.is_secure = Properties::oem_crypto_use_secure_buffers();
|
||||
|
||||
return DoSubsampleDecrypt(parameters,
|
||||
iv,
|
||||
encrypted_buffer,
|
||||
decrypted_block);
|
||||
@@ -249,7 +252,8 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderFrame(
|
||||
const cdm::InputBuffer& encrypted_buffer) {
|
||||
LOGI("WvContentDecryptionModule::DecryptDecodeAndRenderFrame()\n");
|
||||
|
||||
if (encrypted_buffer.iv_size != KEY_IV_SIZE) return cdm::kDecryptError;
|
||||
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);
|
||||
@@ -263,8 +267,7 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderFrame(
|
||||
|
||||
CdmDecryptionParameters parameters(&key_id, encrypted_buffer.data, 0, &iv, 0,
|
||||
NULL);
|
||||
return DoSubsampleDecrypt(session_id, parameters, iv, encrypted_buffer,
|
||||
NULL);
|
||||
return DoSubsampleDecrypt(parameters, iv, encrypted_buffer, NULL);
|
||||
}
|
||||
|
||||
// This is the Level 1 API. When the host application calls the CDM's
|
||||
@@ -275,7 +278,8 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderSamples(
|
||||
const cdm::InputBuffer& encrypted_buffer) {
|
||||
LOGI("WvContentDecryptionModule::DecryptDecodeAndRenderSamples()\n");
|
||||
|
||||
if (encrypted_buffer.iv_size != KEY_IV_SIZE) return cdm::kDecryptError;
|
||||
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);
|
||||
@@ -290,8 +294,7 @@ cdm::Status WvContentDecryptionModule::DecryptDecodeAndRenderSamples(
|
||||
CdmDecryptionParameters parameters(&key_id, encrypted_buffer.data, 0, &iv, 0,
|
||||
NULL);
|
||||
parameters.is_video = false; // override the default true value for audio.
|
||||
return DoSubsampleDecrypt(session_id, parameters, iv, encrypted_buffer,
|
||||
NULL);
|
||||
return DoSubsampleDecrypt(parameters, iv, encrypted_buffer, NULL);
|
||||
}
|
||||
|
||||
void WvContentDecryptionModule::Destroy() { delete this; }
|
||||
@@ -299,7 +302,9 @@ void WvContentDecryptionModule::Destroy() { delete this; }
|
||||
// Provisioning related methods
|
||||
cdm::Status WvContentDecryptionModule::GetProvisioningRequest(
|
||||
std::string* request, std::string* provisioning_server_url) {
|
||||
if (cdm_engine_.GetProvisioningRequest(
|
||||
CdmCertificateType cert_type = kCertificateWidevine;
|
||||
std::string cert_authority;
|
||||
if (cdm_engine_.GetProvisioningRequest(cert_type, cert_authority,
|
||||
static_cast<CdmProvisioningRequest*>(request),
|
||||
provisioning_server_url) == NO_ERROR) {
|
||||
return cdm::kSuccess;
|
||||
@@ -309,8 +314,10 @@ cdm::Status WvContentDecryptionModule::GetProvisioningRequest(
|
||||
|
||||
cdm::Status WvContentDecryptionModule::HandleProvisioningResponse(
|
||||
std::string& response) {
|
||||
std::string cert, wrapped_key;
|
||||
if (cdm_engine_.HandleProvisioningResponse(
|
||||
static_cast<CdmProvisioningRequest&>(response)) == NO_ERROR) {
|
||||
static_cast<CdmProvisioningRequest&>(response), &cert, &wrapped_key) ==
|
||||
NO_ERROR) {
|
||||
return cdm::kSuccess;
|
||||
}
|
||||
return cdm::kSessionError;
|
||||
@@ -333,7 +340,6 @@ void WvContentDecryptionModule::OnTimerEvent() {
|
||||
}
|
||||
|
||||
cdm::Status WvContentDecryptionModule::DoSubsampleDecrypt(
|
||||
CdmSessionId& session_id,
|
||||
CdmDecryptionParameters& parameters,
|
||||
std::vector < uint8_t >& iv,
|
||||
const cdm::InputBuffer& encrypted_buffer,
|
||||
@@ -344,6 +350,8 @@ cdm::Status WvContentDecryptionModule::DoSubsampleDecrypt(
|
||||
information. Also, parameters is expected to be pre-initialized with any
|
||||
needed parameters not related to subsample parsing.
|
||||
decrypted_block may be NULL. */
|
||||
|
||||
CdmSessionId session_id; // it's empty but cdm_engine will locate via key_id.
|
||||
CdmResponseType status = NO_ERROR;
|
||||
uint8_t* output_buffer = decrypted_block
|
||||
? reinterpret_cast<uint8_t*>(
|
||||
@@ -384,9 +392,10 @@ cdm::Status WvContentDecryptionModule::DoSubsampleDecrypt(
|
||||
|
||||
parameters.is_encrypted = is_encrypted;
|
||||
parameters.subsample_flags =
|
||||
(true == first) ? OEMCrypto_FirstSubsample : 0;
|
||||
first ? OEMCrypto_FirstSubsample : 0;
|
||||
parameters.subsample_flags |= (
|
||||
offset == encrypted_buffer.data_size ? OEMCrypto_LastSubsample : 0);
|
||||
offset == static_cast<size_t>(encrypted_buffer.data_size)
|
||||
? OEMCrypto_LastSubsample : 0);
|
||||
|
||||
first = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user