Source release v2.1.5-0-811 + third_party libs

Change-Id: Ic8eafba071e486e671257bc22a8208e86d68b08a
This commit is contained in:
Joey Parrish
2014-07-07 16:22:33 -07:00
parent d7cd9243b0
commit fa64436e4f
13 changed files with 184 additions and 170 deletions

View File

@@ -8,7 +8,7 @@ namespace wvcdm {
bool BufferReader::Read1(uint8_t* v) {
if (!HasBytes(1)) {
LOGE("BufferReader::Read1 : Failure while parsing: Not enough bytes (1)");
LOGW("BufferReader::Read1 : Failure while parsing: Not enough bytes (1)");
return false;
}
@@ -19,7 +19,7 @@ bool BufferReader::Read1(uint8_t* v) {
// Internal implementation of multi-byte reads
template<typename T> bool BufferReader::Read(T* v) {
if (!HasBytes(sizeof(T))) {
LOGE("BufferReader::Read<T> : Failure during parse: Not enough bytes (%u)",
LOGW("BufferReader::Read<T> : Failure during parse: Not enough bytes (%u)",
sizeof(T));
return false;
}
@@ -42,7 +42,7 @@ bool BufferReader::Read8s(int64_t* v) { return Read(v); }
bool BufferReader::ReadString(std::string* str, int count) {
if (!HasBytes(count)) {
LOGE("BufferReader::ReadString : Parse Failure: Not enough bytes (%d)",
LOGW("BufferReader::ReadString : Parse Failure: Not enough bytes (%d)",
count);
return false;
}
@@ -54,7 +54,7 @@ bool BufferReader::ReadString(std::string* str, int count) {
bool BufferReader::ReadVec(std::vector<uint8_t>* vec, int count) {
if (!HasBytes(count)) {
LOGE("BufferReader::ReadVec : Parse Failure: Not enough bytes (%d)", count);
LOGW("BufferReader::ReadVec : Parse Failure: Not enough bytes (%d)", count);
return false;
}
@@ -66,7 +66,7 @@ bool BufferReader::ReadVec(std::vector<uint8_t>* vec, int count) {
bool BufferReader::SkipBytes(int bytes) {
if (!HasBytes(bytes)) {
LOGE("BufferReader::SkipBytes : Parse Failure: Not enough bytes (%d)",
LOGW("BufferReader::SkipBytes : Parse Failure: Not enough bytes (%d)",
bytes);
return false;
}

View File

@@ -73,8 +73,12 @@ void CdmSession::Create(
is_release_ = false;
is_usage_update_needed_ = false;
is_initial_decryption_ = true;
security_level_ = crypto_session_.get()->GetSecurityLevel();
if (cdm_client_property_set) {
requested_security_level_ = kLevelDefault;
if (NULL != cdm_client_property_set) {
if (QUERY_VALUE_SECURITY_LEVEL_L3.compare(
cdm_client_property_set->security_level()) == 0) {
requested_security_level_ = kLevel3;
}
Properties::AddSessionPropertySet(session_id_, cdm_client_property_set);
}
}
@@ -90,8 +94,9 @@ CdmResponseType CdmSession::Init() {
LOGE("CdmSession::Init: Failed due to previous initialization");
return UNKNOWN_ERROR;
}
CdmResponseType sts = crypto_session_->Open(GetRequestedSecurityLevel());
CdmResponseType sts = crypto_session_->Open(requested_security_level_);
if (NO_ERROR != sts) return sts;
security_level_ = crypto_session_->GetSecurityLevel();
std::string token;
if (Properties::use_certificates_as_identification()) {
@@ -271,7 +276,7 @@ CdmResponseType CdmSession::QueryStatus(CdmQueryMap* key_info) {
return UNKNOWN_ERROR;
}
switch (crypto_session_->GetSecurityLevel()) {
switch (security_level_) {
case kSecurityLevelL1:
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L1;
break;
@@ -530,23 +535,6 @@ void CdmSession::OnKeyReleaseEvent(const CdmKeySetId& key_set_id) {
}
}
SecurityLevel CdmSession::GetRequestedSecurityLevel() {
std::string security_level;
if (Properties::GetSecurityLevel(session_id_, &security_level) &&
security_level == QUERY_VALUE_SECURITY_LEVEL_L3) {
return kLevel3;
}
return kLevelDefault;
}
CdmSecurityLevel CdmSession::GetSecurityLevel() {
if (NULL == crypto_session_.get())
return kSecurityLevelUninitialized;
return crypto_session_.get()->GetSecurityLevel();
}
CdmResponseType CdmSession::UpdateUsageInformation() {
return crypto_session_->UpdateUsageInformation();
}

View File

@@ -168,13 +168,9 @@ bool CryptoSession::GetApiVersion(uint32_t* version) {
if (!initialized_) {
return false;
}
CdmSecurityLevel level = GetSecurityLevel();
SecurityLevel security_level = kLevelDefault;
if (kSecurityLevelL3 == level) security_level = kLevel3;
LOGV("CryptoSession::GetApiVersion: Lock");
AutoLock auto_lock(crypto_lock_);
*version = OEMCrypto_APIVersion(security_level);
*version = OEMCrypto_APIVersion(requested_security_level_);
return true;
}

View File

@@ -65,8 +65,6 @@ bool Properties::GetSecurityLevel(const CdmSessionId& session_id,
const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id);
if (NULL == property_set) {
LOGE("Properties::GetSecurityLevel: cannot find property set for %s",
session_id.c_str());
return false;
}
*security_level = property_set->security_level();
@@ -78,8 +76,6 @@ bool Properties::GetServiceCertificate(const CdmSessionId& session_id,
const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id);
if (NULL == property_set) {
LOGE("Properties::GetServiceCertificate: cannot find property set for %s",
session_id.c_str());
return false;
}
*service_certificate = property_set->service_certificate();
@@ -90,8 +86,6 @@ bool Properties::UsePrivacyMode(const CdmSessionId& session_id) {
const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id);
if (NULL == property_set) {
LOGE("Properties::UsePrivacyMode: cannot find property set for %s",
session_id.c_str());
return false;
}
return property_set->use_privacy_mode();
@@ -101,8 +95,6 @@ uint32_t Properties::GetSessionSharingId(const CdmSessionId& session_id) {
const CdmClientPropertySet* property_set =
GetCdmClientPropertySet(session_id);
if (NULL == property_set) {
LOGE("Properties::GetSessionSharingId: cannot find property set for %s",
session_id.c_str());
return 0;
}
return property_set->session_sharing_id();