Merge "Clean up CdmEngine logs." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-04-23 20:35:53 +00:00
committed by Android (Google) Code Review
8 changed files with 391 additions and 350 deletions

View File

@@ -61,6 +61,7 @@ cc_library_static {
CORE_SRC_DIR + "/privacy_crypto_boringssl.cpp",
CORE_SRC_DIR + "/service_certificate.cpp",
CORE_SRC_DIR + "/usage_table_header.cpp",
CORE_SRC_DIR + "/wv_cdm_types.cpp",
SRC_DIR + "/wv_content_decryption_module.cpp",
METRICS_SRC_DIR + "/attribute_handler.cpp",
METRICS_SRC_DIR + "/counter_metric.cpp",

View File

@@ -25,6 +25,7 @@
namespace wvcdm {
class CryptoKey;
class CryptoSessionFactory;
class UsageTableHeader;
using CryptoKeyMap = std::map<std::string, CryptoKey*>;
@@ -40,8 +41,6 @@ OEMCrypto_Substring GetSubstring(const std::string& message = "",
bool set_zero = false);
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
class CryptoSessionFactory;
class CryptoSession {
public:
using HdcpCapability = OEMCrypto_HDCP_Capability;

View File

@@ -21,7 +21,6 @@ class VersionInfo;
} // namespace video_widevine
namespace wvcdm {
class Clock;
class CryptoSession;
class PolicyEngine;
@@ -186,7 +185,6 @@ class CdmLicense {
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
};
} // namespace wvcdm
#endif // WVCDM_CORE_LICENSE_H_

View File

@@ -793,6 +793,22 @@ class KeyMessage;
class Request;
class Key;
// Logging utilities for types defined above.
// Converts the different enum types to a human readable C-string for
// logging. Query strings values are used if available for the enum.
// These functions will fail silently to avoid double logging.
const char* CdmCertificateTypeToString(CdmCertificateType type);
const char* CdmLicenseTypeToString(CdmLicenseType license_type);
const char* CdmSecurityLevelToString(CdmSecurityLevel security_level);
const char* SecurityLevelToString(SecurityLevel security_level);
// Both IdToString() and IdPtrToString() functions are used to convert
// session IDs, key set IDs or other CDM specific identifiers to a
// loggable format.
const char* IdToString(const std::string& id);
// Some CDM API function allow for optional string parameters to be
// provided as string pointers.
const char* IdPtrToString(const std::string* id);
} // namespace wvcdm
#endif // WVCDM_CORE_WV_CDM_TYPES_H_

File diff suppressed because it is too large Load Diff

View File

@@ -15,8 +15,8 @@
#include "string_conversions.h"
#include "wv_cdm_constants.h"
namespace wvcdm {
namespace {
const std::string kEmptyString;
// URL for Google Provisioning Server.
@@ -104,10 +104,7 @@ bool ExtractAndDecodeSignedMessage(const std::string& provisioning_response,
result->assign(decoded_message.begin(), decoded_message.end());
return true;
}
} // namespace
namespace wvcdm {
// Protobuf generated classes.
using video_widevine::ClientIdentification_ClientCapabilities;
using video_widevine::ClientIdentification_NameValue;

View File

@@ -164,11 +164,6 @@ size_t GenericEncryptionBlockSize(CdmEncryptionAlgorithm algorithm) {
}
return kAes128BlockSize;
}
const char* SecurityLevelToString(SecurityLevel security_level) {
return security_level == kLevel3 ? QUERY_VALUE_SECURITY_LEVEL_L3.c_str()
: QUERY_VALUE_SECURITY_LEVEL_DEFAULT.c_str();
}
} // namespace
shared_mutex CryptoSession::static_field_mutex_;

View File

@@ -0,0 +1,76 @@
// Copyright 2021 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#include "wv_cdm_types.h"
#include "wv_cdm_constants.h"
namespace wvcdm {
namespace {
const char kEmptyIdRep[] = "<empty>";
const char kNullIdRep[] = "<null>";
const char kUnknownValueRep[] = "<unknown>";
} // namespace
const char* CdmCertificateTypeToString(CdmCertificateType type) {
switch (type) {
case kCertificateWidevine:
return "Widevine";
case kCertificateX509:
return "x509";
}
return kUnknownValueRep;
}
const char* CdmLicenseTypeToString(CdmLicenseType license_type) {
switch (license_type) {
case kLicenseTypeOffline:
return "Offline";
case kLicenseTypeStreaming:
return "Streaming";
case kLicenseTypeRelease:
return "Release";
case kLicenseTypeTemporary:
return "Temporary";
case kLicenseTypeEmbeddedKeyData:
return "EmbeddedKeyData";
}
return kUnknownValueRep;
}
const char* CdmSecurityLevelToString(CdmSecurityLevel security_level) {
switch (security_level) {
case kSecurityLevelUninitialized:
return "Uninitialized";
case kSecurityLevelL1:
return QUERY_VALUE_SECURITY_LEVEL_L1.c_str();
case kSecurityLevelL2:
return QUERY_VALUE_SECURITY_LEVEL_L2.c_str();
case kSecurityLevelL3:
return QUERY_VALUE_SECURITY_LEVEL_L3.c_str();
case kSecurityLevelUnknown:
break;
}
return QUERY_VALUE_SECURITY_LEVEL_UNKNOWN.c_str();
}
const char* SecurityLevelToString(SecurityLevel security_level) {
switch (security_level) {
case kLevelDefault:
return QUERY_VALUE_SECURITY_LEVEL_DEFAULT.c_str();
case kLevel3:
return QUERY_VALUE_SECURITY_LEVEL_L3.c_str();
}
return kUnknownValueRep;
}
const char* IdToString(const std::string& id) {
return id.empty() ? kEmptyIdRep : id.c_str();
}
const char* IdPtrToString(const std::string* id) {
if (id == nullptr) return kNullIdRep;
return id->empty() ? kEmptyIdRep : id->c_str();
}
} // namespace wvcdm