Merge "Clean up CdmEngine logs." into sc-dev am: bee62d797e
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/14137667 Change-Id: Ib4c932dfacb63d62590e43db80b818bd63fcec31
This commit is contained in:
@@ -61,6 +61,7 @@ cc_library_static {
|
|||||||
CORE_SRC_DIR + "/privacy_crypto_boringssl.cpp",
|
CORE_SRC_DIR + "/privacy_crypto_boringssl.cpp",
|
||||||
CORE_SRC_DIR + "/service_certificate.cpp",
|
CORE_SRC_DIR + "/service_certificate.cpp",
|
||||||
CORE_SRC_DIR + "/usage_table_header.cpp",
|
CORE_SRC_DIR + "/usage_table_header.cpp",
|
||||||
|
CORE_SRC_DIR + "/wv_cdm_types.cpp",
|
||||||
SRC_DIR + "/wv_content_decryption_module.cpp",
|
SRC_DIR + "/wv_content_decryption_module.cpp",
|
||||||
METRICS_SRC_DIR + "/attribute_handler.cpp",
|
METRICS_SRC_DIR + "/attribute_handler.cpp",
|
||||||
METRICS_SRC_DIR + "/counter_metric.cpp",
|
METRICS_SRC_DIR + "/counter_metric.cpp",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
|
|
||||||
class CryptoKey;
|
class CryptoKey;
|
||||||
|
class CryptoSessionFactory;
|
||||||
class UsageTableHeader;
|
class UsageTableHeader;
|
||||||
|
|
||||||
using CryptoKeyMap = std::map<std::string, CryptoKey*>;
|
using CryptoKeyMap = std::map<std::string, CryptoKey*>;
|
||||||
@@ -40,8 +41,6 @@ OEMCrypto_Substring GetSubstring(const std::string& message = "",
|
|||||||
bool set_zero = false);
|
bool set_zero = false);
|
||||||
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
|
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
|
||||||
|
|
||||||
class CryptoSessionFactory;
|
|
||||||
|
|
||||||
class CryptoSession {
|
class CryptoSession {
|
||||||
public:
|
public:
|
||||||
using HdcpCapability = OEMCrypto_HDCP_Capability;
|
using HdcpCapability = OEMCrypto_HDCP_Capability;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class VersionInfo;
|
|||||||
} // namespace video_widevine
|
} // namespace video_widevine
|
||||||
|
|
||||||
namespace wvcdm {
|
namespace wvcdm {
|
||||||
|
|
||||||
class Clock;
|
class Clock;
|
||||||
class CryptoSession;
|
class CryptoSession;
|
||||||
class PolicyEngine;
|
class PolicyEngine;
|
||||||
@@ -186,7 +185,6 @@ class CdmLicense {
|
|||||||
|
|
||||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
|
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wvcdm
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_CORE_LICENSE_H_
|
#endif // WVCDM_CORE_LICENSE_H_
|
||||||
|
|||||||
@@ -793,6 +793,22 @@ class KeyMessage;
|
|||||||
class Request;
|
class Request;
|
||||||
class Key;
|
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
|
} // namespace wvcdm
|
||||||
|
|
||||||
#endif // WVCDM_CORE_WV_CDM_TYPES_H_
|
#endif // WVCDM_CORE_WV_CDM_TYPES_H_
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -15,8 +15,8 @@
|
|||||||
#include "string_conversions.h"
|
#include "string_conversions.h"
|
||||||
#include "wv_cdm_constants.h"
|
#include "wv_cdm_constants.h"
|
||||||
|
|
||||||
|
namespace wvcdm {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const std::string kEmptyString;
|
const std::string kEmptyString;
|
||||||
|
|
||||||
// URL for Google Provisioning Server.
|
// URL for Google Provisioning Server.
|
||||||
@@ -104,10 +104,7 @@ bool ExtractAndDecodeSignedMessage(const std::string& provisioning_response,
|
|||||||
result->assign(decoded_message.begin(), decoded_message.end());
|
result->assign(decoded_message.begin(), decoded_message.end());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace wvcdm {
|
|
||||||
// Protobuf generated classes.
|
// Protobuf generated classes.
|
||||||
using video_widevine::ClientIdentification_ClientCapabilities;
|
using video_widevine::ClientIdentification_ClientCapabilities;
|
||||||
using video_widevine::ClientIdentification_NameValue;
|
using video_widevine::ClientIdentification_NameValue;
|
||||||
|
|||||||
@@ -164,11 +164,6 @@ size_t GenericEncryptionBlockSize(CdmEncryptionAlgorithm algorithm) {
|
|||||||
}
|
}
|
||||||
return kAes128BlockSize;
|
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
|
} // namespace
|
||||||
|
|
||||||
shared_mutex CryptoSession::static_field_mutex_;
|
shared_mutex CryptoSession::static_field_mutex_;
|
||||||
|
|||||||
76
libwvdrmengine/cdm/core/src/wv_cdm_types.cpp
Normal file
76
libwvdrmengine/cdm/core/src/wv_cdm_types.cpp
Normal 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
|
||||||
Reference in New Issue
Block a user