Merge "Added CDM support for Watermarking reporting." into tm-dev
This commit is contained in:
@@ -795,6 +795,28 @@ CdmResponseType CdmEngine::QueryStatus(RequestedSecurityLevel security_level,
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
if (query_token == QUERY_KEY_WATERMARKING_SUPPORT) {
|
||||
CdmWatermarkingSupport support;
|
||||
if (!crypto_session->GetWatermarkingSupport(security_level, &support)) {
|
||||
// Assume not supported.
|
||||
support = kWatermarkingNotSupported;
|
||||
}
|
||||
switch (support) {
|
||||
case kWatermarkingNotSupported:
|
||||
*query_response = QUERY_VALUE_NOT_SUPPORTED;
|
||||
break;
|
||||
case kWatermarkingConfigurable:
|
||||
*query_response = QUERY_VALUE_CONFIGURABLE;
|
||||
break;
|
||||
case kWatermarkingAlwaysOn:
|
||||
*query_response = QUERY_VALUE_ALWAYS_ON;
|
||||
break;
|
||||
default:
|
||||
LOGW("Unknown watermarking support: %d", static_cast<int>(support));
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType status;
|
||||
M_TIME(status = crypto_session->Open(security_level),
|
||||
|
||||
@@ -343,6 +343,28 @@ CdmResponseType ClientIdentification::Prepare(
|
||||
}
|
||||
}
|
||||
|
||||
if (is_license_request_) {
|
||||
CdmWatermarkingSupport support;
|
||||
if (!crypto_session_->GetWatermarkingSupport(&support)) {
|
||||
// Assume not supported.
|
||||
support = kWatermarkingNotSupported;
|
||||
}
|
||||
switch (support) {
|
||||
case kWatermarkingNotSupported:
|
||||
client_capabilities->set_watermarking_support(
|
||||
ClientCapabilities::WATERMARKING_NOT_SUPPORTED);
|
||||
break;
|
||||
case kWatermarkingConfigurable:
|
||||
client_capabilities->set_watermarking_support(
|
||||
ClientCapabilities::WATERMARKING_CONFIGURABLE);
|
||||
break;
|
||||
case kWatermarkingAlwaysOn:
|
||||
client_capabilities->set_watermarking_support(
|
||||
ClientCapabilities::WATERMARKING_ALWAYS_ON);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -2309,6 +2309,41 @@ bool CryptoSession::GetBuildInformation(RequestedSecurityLevel security_level,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetWatermarkingSupport(CdmWatermarkingSupport* support) {
|
||||
RETURN_IF_NOT_OPEN(false);
|
||||
return GetWatermarkingSupport(requested_security_level_, support);
|
||||
}
|
||||
|
||||
bool CryptoSession::GetWatermarkingSupport(
|
||||
RequestedSecurityLevel security_level, CdmWatermarkingSupport* support) {
|
||||
LOGV("security_level = %s", RequestedSecurityLevelToString(security_level));
|
||||
RETURN_IF_UNINITIALIZED(false);
|
||||
RETURN_IF_NULL(support, false);
|
||||
const OEMCrypto_WatermarkingSupport oec_support = WithOecReadLock(
|
||||
"GetWatermarkingSupport",
|
||||
[&] { return OEMCrypto_GetWatermarkingSupport(security_level); });
|
||||
switch (oec_support) {
|
||||
case OEMCrypto_WatermarkingNotSupported:
|
||||
*support = kWatermarkingNotSupported;
|
||||
break;
|
||||
case OEMCrypto_WatermarkingConfigurable:
|
||||
*support = kWatermarkingConfigurable;
|
||||
break;
|
||||
case OEMCrypto_WatermarkingAlwaysOn:
|
||||
*support = kWatermarkingAlwaysOn;
|
||||
break;
|
||||
case OEMCrypto_WatermarkingError:
|
||||
default:
|
||||
LOGE("GetWatermarkingSupport error: security_level = %s, result = %d",
|
||||
RequestedSecurityLevelToString(security_level),
|
||||
static_cast<int>(oec_support));
|
||||
metrics_->oemcrypto_watermarking_support_.SetError(oec_support);
|
||||
return false;
|
||||
}
|
||||
metrics_->oemcrypto_watermarking_support_.Record(oec_support);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetMaximumUsageTableEntries(
|
||||
RequestedSecurityLevel security_level, size_t* number_of_entries) {
|
||||
LOGV("Getting maximum usage table entries: security_level = %s",
|
||||
|
||||
@@ -908,6 +908,13 @@ message ClientIdentification {
|
||||
ANALOG_OUTPUT_SUPPORTS_CGMS_A = 3;
|
||||
}
|
||||
|
||||
enum WatermarkingSupport {
|
||||
WATERMARKING_SUPPORT_UNKNOWN = 0;
|
||||
WATERMARKING_NOT_SUPPORTED = 1;
|
||||
WATERMARKING_CONFIGURABLE = 2;
|
||||
WATERMARKING_ALWAYS_ON = 3;
|
||||
}
|
||||
|
||||
optional bool client_token = 1 [default = false];
|
||||
optional bool session_token = 2 [default = false];
|
||||
optional bool video_resolution_constraints = 3 [default = false];
|
||||
@@ -932,6 +939,10 @@ message ClientIdentification {
|
||||
// the resource rating is unavailable or reporting erroneous values
|
||||
// for that device.
|
||||
optional uint32 resource_rating_tier = 12 [default = 0];
|
||||
// Watermarking support of OEMCrypto was introduced in v17.
|
||||
// Support is optional.
|
||||
// Value is only required to be set for license requests.
|
||||
optional WatermarkingSupport watermarking_support = 13;
|
||||
}
|
||||
|
||||
message ClientCredentials {
|
||||
|
||||
@@ -1896,6 +1896,17 @@ OEMCryptoResult OEMCrypto_SetDebugIgnoreKeyboxCount(uint32_t count) {
|
||||
OEMCryptoResult OEMCrypto_SetAllowTestKeybox(bool allow) {
|
||||
return SetAllowTestKeybox(allow);
|
||||
}
|
||||
|
||||
OEMCrypto_WatermarkingSupport OEMCrypto_GetWatermarkingSupport(
|
||||
wvcdm::RequestedSecurityLevel level) {
|
||||
if (!gAdapter) return OEMCrypto_WatermarkingError;
|
||||
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(level);
|
||||
if (!fcn) return OEMCrypto_WatermarkingError;
|
||||
if (fcn->version < 17) return OEMCrypto_WatermarkingNotSupported;
|
||||
if (fcn->GetWatermarkingSupport == nullptr)
|
||||
return OEMCrypto_WatermarkingError;
|
||||
return fcn->GetWatermarkingSupport();
|
||||
}
|
||||
} // namespace wvcdm
|
||||
|
||||
extern "C" OEMCryptoResult OEMCrypto_SetSandbox(const uint8_t* sandbox_id,
|
||||
@@ -3403,12 +3414,7 @@ extern "C" OEMCryptoResult OEMCrypto_GetDTCP2Capability(
|
||||
return fcn->GetDTCP2Capability(capability);
|
||||
}
|
||||
|
||||
extern "C" OEMCrypto_WatermarkingSupport OEMCrypto_GetWatermarkingSupport() {
|
||||
if (!gAdapter) return OEMCrypto_WatermarkingError;
|
||||
const FunctionPointers* fcn = gAdapter->GetFunctionPointers(kLevelDefault);
|
||||
if (!fcn) return OEMCrypto_WatermarkingError;
|
||||
if (fcn->version < 17) return OEMCrypto_WatermarkingError;
|
||||
if (fcn->GetWatermarkingSupport == nullptr)
|
||||
return OEMCrypto_WatermarkingError;
|
||||
return fcn->GetWatermarkingSupport();
|
||||
extern "C" OEMCrypto_WatermarkingSupport OEMCrypto_GetWatermarkingSupport(
|
||||
void) {
|
||||
return wvcdm::OEMCrypto_GetWatermarkingSupport(kLevelDefault);
|
||||
}
|
||||
|
||||
@@ -119,6 +119,18 @@ const char* RequestedSecurityLevelToString(
|
||||
return UnknownValueRep(security_level);
|
||||
}
|
||||
|
||||
const char* CdmWatermarkingSupportToString(CdmWatermarkingSupport support) {
|
||||
switch (support) {
|
||||
case kWatermarkingNotSupported:
|
||||
return QUERY_VALUE_NOT_SUPPORTED.c_str();
|
||||
case kWatermarkingConfigurable:
|
||||
return QUERY_VALUE_CONFIGURABLE.c_str();
|
||||
case kWatermarkingAlwaysOn:
|
||||
return QUERY_VALUE_ALWAYS_ON.c_str();
|
||||
}
|
||||
return UnknownValueRep(support);
|
||||
}
|
||||
|
||||
const char* UnknownEnumValueToString(int value) {
|
||||
snprintf(tl_unknown_rep_buf, sizeof(tl_unknown_rep_buf), "<unknown(%d)>",
|
||||
value);
|
||||
|
||||
Reference in New Issue
Block a user