Add support for Resource Rating Tiers
[ Merge of http://go/wvgerrit/67324 ] This introduces the ability to query resource rating tier information through the plugin and CDM. Resource rating tiers are also sent in the client identification portion of the license request. Bug: 117112392 Test: WV unit/integration tests Change-Id: I68ac6dfc4362f61150af822bd526e346b5cc4bf7
This commit is contained in:
@@ -642,6 +642,16 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
|
||||
}
|
||||
|
||||
*query_response = cdm_version;
|
||||
} else if (query_token == QUERY_KEY_RESOURCE_RATING_TIER) {
|
||||
uint32_t tier;
|
||||
if (!crypto_session->GetResourceRatingTier(&tier)) {
|
||||
LOGW("CdmEngine::QueryStatus: GetResourceRatingTier failed");
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
std::ostringstream tier_stream;
|
||||
tier_stream << tier;
|
||||
*query_response = tier_stream.str();
|
||||
} else if (query_token == QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION) {
|
||||
if (!crypto_session->GetBuildInformation(query_response)) {
|
||||
LOGW("CdmEngine::QueryStatus: GetBuildInformation failed");
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "log.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
namespace {
|
||||
const std::string kKeyCompanyName = "company_name";
|
||||
@@ -254,6 +255,15 @@ CdmResponseType ClientIdentification::Prepare(
|
||||
client_capabilities->set_analog_output_capabilities(video_widevine::ClientIdentification_ClientCapabilities_AnalogOutputCapabilities_ANALOG_OUTPUT_UNKNOWN);
|
||||
}
|
||||
|
||||
uint32_t version, tier;
|
||||
if (crypto_session_->GetApiVersion(&version)) {
|
||||
if (version >= OEM_CRYPTO_API_VERSION_SUPPORTS_RESOURCE_RATING_TIER) {
|
||||
if (crypto_session_->GetResourceRatingTier(&tier)) {
|
||||
client_capabilities->set_resource_rating_tier(tier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -1773,6 +1773,25 @@ bool CryptoSession::LoadSrm(const std::string& srm) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetResourceRatingTier(uint32_t* tier) {
|
||||
LOGV("GetResourceRatingTier");
|
||||
if (!initialized_) return false;
|
||||
if (tier == nullptr) {
|
||||
LOGE("tier destination not provided");
|
||||
return false;
|
||||
}
|
||||
*tier = OEMCrypto_ResourceRatingTier(requested_security_level_);
|
||||
if (*tier < RESOURCE_RATING_TIER_LOW || *tier > RESOURCE_RATING_TIER_HIGH) {
|
||||
uint32_t api_version;
|
||||
if (GetApiVersion(&api_version)) {
|
||||
if (api_version >= OEM_CRYPTO_API_VERSION_SUPPORTS_RESOURCE_RATING_TIER) {
|
||||
LOGW("GetResourceRatingTier: invalid resource rating tier: %d", *tier);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetBuildInformation(std::string* info) {
|
||||
LOGV("GetBuildInformation");
|
||||
if (!initialized_) return false;
|
||||
|
||||
Reference in New Issue
Block a user