From af71f66aa438602b0c760a78ca40511a625d181a Mon Sep 17 00:00:00 2001 From: Aaron Vaage Date: Tue, 17 Jan 2017 17:53:40 -0800 Subject: [PATCH] Removing Widevine OEMCrypto Profiler This is a merge of go/wvgerrit/22806 This change removed the oemcrypto profiler to allow the new metrics system free-reign over how to collect and store measurements. Bug: 33745339 Bug: 26027857 Change-Id: I6b9051faa6835f13860258c94f8bcfd3a59f1be6 --- libwvdrmengine/Android.mk | 1 - libwvdrmengine/cdm/Android.mk | 8 +- .../core/src/oemcrypto_adapter_dynamic.cpp | 163 ------------- .../cdm/profiler/include/call_history.h | 49 ---- .../cdm/profiler/include/circular_buffer.h | 62 ----- .../cdm/profiler/include/entry_writer.h | 71 ------ .../cdm/profiler/include/oem_functions.h | 62 ----- .../cdm/profiler/include/profiled_scope.h | 36 --- .../cdm/profiler/include/profiler.h | 22 -- .../cdm/profiler/src/call_history.cpp | 170 ------------- .../cdm/profiler/src/circular_buffer.cpp | 92 ------- .../cdm/profiler/src/entry_writer.cpp | 109 --------- .../cdm/profiler/src/profiled_scope.cpp | 43 ---- libwvdrmengine/cdm/profiler/src/profiler.cpp | 16 -- .../profiler/test/circular_buffer_test.cpp | 225 ------------------ .../cdm/profiler/test/entry_writer_test.cpp | 168 ------------- libwvdrmengine/cdm/test/Android.mk | 8 - libwvdrmengine/mediadrm/Android.mk | 1 - libwvdrmengine/mediadrm/include/WVDrmPlugin.h | 8 - libwvdrmengine/mediadrm/src/WVDrmPlugin.cpp | 23 +- libwvdrmengine/mediadrm/test/Android.mk | 1 - 21 files changed, 2 insertions(+), 1336 deletions(-) delete mode 100644 libwvdrmengine/cdm/profiler/include/call_history.h delete mode 100644 libwvdrmengine/cdm/profiler/include/circular_buffer.h delete mode 100644 libwvdrmengine/cdm/profiler/include/entry_writer.h delete mode 100644 libwvdrmengine/cdm/profiler/include/oem_functions.h delete mode 100644 libwvdrmengine/cdm/profiler/include/profiled_scope.h delete mode 100644 libwvdrmengine/cdm/profiler/include/profiler.h delete mode 100644 libwvdrmengine/cdm/profiler/src/call_history.cpp delete mode 100644 libwvdrmengine/cdm/profiler/src/circular_buffer.cpp delete mode 100644 libwvdrmengine/cdm/profiler/src/entry_writer.cpp delete mode 100644 libwvdrmengine/cdm/profiler/src/profiled_scope.cpp delete mode 100644 libwvdrmengine/cdm/profiler/src/profiler.cpp delete mode 100644 libwvdrmengine/cdm/profiler/test/circular_buffer_test.cpp delete mode 100644 libwvdrmengine/cdm/profiler/test/entry_writer_test.cpp diff --git a/libwvdrmengine/Android.mk b/libwvdrmengine/Android.mk index 342c9378..ff3e09bd 100644 --- a/libwvdrmengine/Android.mk +++ b/libwvdrmengine/Android.mk @@ -79,7 +79,6 @@ LOCAL_C_INCLUDES := \ frameworks/av/include \ frameworks/native/include \ vendor/widevine/libwvdrmengine/cdm/core/include \ - vendor/widevine/libwvdrmengine/cdm/profiler/include \ vendor/widevine/libwvdrmengine/cdm/include \ vendor/widevine/libwvdrmengine/include \ vendor/widevine/libwvdrmengine/mediacrypto/include \ diff --git a/libwvdrmengine/cdm/Android.mk b/libwvdrmengine/cdm/Android.mk index 1035f7b1..286d4dc6 100644 --- a/libwvdrmengine/cdm/Android.mk +++ b/libwvdrmengine/cdm/Android.mk @@ -5,7 +5,6 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_C_INCLUDES := \ - vendor/widevine/libwvdrmengine/cdm/profiler/include \ vendor/widevine/libwvdrmengine/cdm/core/include \ vendor/widevine/libwvdrmengine/cdm/include \ vendor/widevine/libwvdrmengine/oemcrypto/include \ @@ -19,7 +18,6 @@ LOCAL_STATIC_LIBRARIES := libcdm_protos libcrypto_static SRC_DIR := src CORE_SRC_DIR := core/src -PROFILER_SRC_DIR := profiler/src LOCAL_SRC_FILES := \ $(CORE_SRC_DIR)/buffer_reader.cpp \ @@ -35,11 +33,7 @@ LOCAL_SRC_FILES := \ $(CORE_SRC_DIR)/policy_engine.cpp \ $(CORE_SRC_DIR)/privacy_crypto_openssl.cpp \ $(SRC_DIR)/wv_content_decryption_module.cpp \ - $(PROFILER_SRC_DIR)/circular_buffer.cpp \ - $(PROFILER_SRC_DIR)/entry_writer.cpp \ - $(PROFILER_SRC_DIR)/profiled_scope.cpp \ - $(PROFILER_SRC_DIR)/profiler.cpp \ - $(PROFILER_SRC_DIR)/call_history.cpp + LOCAL_MODULE := libcdm LOCAL_MODULE_TAGS := optional diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index 12ec36be..d74d58bf 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -29,7 +29,6 @@ #include "level3.h" #include "lock.h" #include "log.h" -#include "profiled_scope.h" #include "properties.h" #include "wv_cdm_constants.h" @@ -598,9 +597,6 @@ class Adapter { OEMCryptoResult OpenSession(OEMCrypto_SESSION* session, wvcdm::SecurityLevel level) { - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_OPEN_SESSION); - LevelSession new_session; OEMCryptoResult result; if (level == kLevelDefault && level1_valid_) { @@ -625,9 +621,6 @@ class Adapter { } OEMCryptoResult CloseSession(OEMCrypto_SESSION session) { - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_CLOSE_SESSION); - wvcdm::AutoLock auto_lock(session_map_lock_); map_iterator pair = session_map_.find(session); if (pair == session_map_.end()) { @@ -676,11 +669,6 @@ OEMCryptoResult OEMCrypto_OpenSession(OEMCrypto_SESSION* session, OEMCryptoResult OEMCrypto_CopyBuffer( SecurityLevel level, const uint8_t* data_addr, size_t data_length, OEMCrypto_DestBufferDesc* out_buffer, uint8_t subsample_flags) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_COPY_BUFFER); - - ps.meta_data_.WriteVLV(static_cast(data_length)); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -691,9 +679,6 @@ OEMCryptoResult OEMCrypto_CopyBuffer( OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox, size_t keyBoxLength, SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_INSTALL_KEYBOX); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -702,8 +687,6 @@ OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox, OEMCrypto_ProvisioningMethod OEMCrypto_GetProvisioningMethod( SecurityLevel level) { - oemprofiler::ProfiledScope ps( - oemprofiler::OEM_FUNCTION_GET_PROVISIONING_METHOD); if (!kAdapter) return OEMCrypto_ProvisioningError; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ProvisioningError; @@ -712,9 +695,6 @@ OEMCrypto_ProvisioningMethod OEMCrypto_GetProvisioningMethod( } OEMCryptoResult OEMCrypto_IsKeyboxValid(SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_IS_KEYBOX_VALID); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -723,9 +703,6 @@ OEMCryptoResult OEMCrypto_IsKeyboxValid(SecurityLevel level) { OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID, size_t* idLength, SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_DEVICE_ID); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -734,9 +711,6 @@ OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID, size_t* idLength, OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData, size_t* keyDataLength, SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_KEY_DATA); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -744,9 +718,6 @@ OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData, size_t* keyDataLength, } uint32_t OEMCrypto_APIVersion(SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_API_VERSION); - if (!kAdapter) return 0; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return 0; @@ -754,9 +725,6 @@ uint32_t OEMCrypto_APIVersion(SecurityLevel level) { } uint8_t OEMCrypto_Security_Patch_Level(SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SECURITY_PATCH_LEVEL); - if (!kAdapter) return 0; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return 0; @@ -765,9 +733,6 @@ uint8_t OEMCrypto_Security_Patch_Level(SecurityLevel level) { } const char* OEMCrypto_SecurityLevel(SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SECURITY_LEVEL); - if (!kAdapter) return ""; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return ""; @@ -777,9 +742,6 @@ const char* OEMCrypto_SecurityLevel(SecurityLevel level) { OEMCryptoResult OEMCrypto_GetHDCPCapability( SecurityLevel level, OEMCrypto_HDCP_Capability* current, OEMCrypto_HDCP_Capability* maximum) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_HDCP_CAPABILITIY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_NOT_IMPLEMENTED; @@ -798,9 +760,6 @@ OEMCryptoResult OEMCrypto_GetHDCPCapability( } bool OEMCrypto_SupportsUsageTable(SecurityLevel level) { - - oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SUPPORTS_USAGE_TABLE); - if (!kAdapter) return false; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return false; @@ -809,10 +768,6 @@ bool OEMCrypto_SupportsUsageTable(SecurityLevel level) { } bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level) { - - oemprofiler::ProfiledScope ps( - oemprofiler::OEM_FUNCTION_IS_ANTI_ROLLBACK_HW_PRESENT); - if (!kAdapter) return false; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return false; @@ -822,10 +777,6 @@ bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level) { OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level, size_t* count) { - - oemprofiler::ProfiledScope ps( - oemprofiler::OEM_FUNCTION_GET_NUMBER_OF_OPEN_SESSIONS); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -835,10 +786,6 @@ OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level, OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(SecurityLevel level, size_t* maximum) { - - oemprofiler::ProfiledScope ps( - oemprofiler::OEM_FUNCTION_GET_MAX_NUMBER_OF_SESSIONS); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(level); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -879,10 +826,6 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys( OEMCrypto_SESSION session, const uint8_t* mac_key_context, uint32_t mac_key_context_length, const uint8_t* enc_key_context, uint32_t enc_key_context_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_DERIVED_KEYS); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -893,10 +836,6 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys( extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session, uint32_t* nonce) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_NONCE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -906,10 +845,6 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session, extern "C" OEMCryptoResult OEMCrypto_GenerateSignature( OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, uint8_t* signature, size_t* signature_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_SIGNATURE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -923,10 +858,6 @@ extern "C" OEMCryptoResult OEMCrypto_LoadKeys( const uint8_t* enc_mac_key_iv, const uint8_t* enc_mac_key, size_t num_keys, const OEMCrypto_KeyObject* key_array, const uint8_t* pst, size_t pst_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_LOAD_KEYS); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -967,10 +898,6 @@ extern "C" OEMCryptoResult OEMCrypto_RefreshKeys( OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, const uint8_t* signature, size_t signature_length, size_t num_keys, const OEMCrypto_KeyRefreshObject* key_array) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_REFRESH_KEYS); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -981,10 +908,6 @@ extern "C" OEMCryptoResult OEMCrypto_RefreshKeys( extern "C" OEMCryptoResult OEMCrypto_QueryKeyControl( OEMCrypto_SESSION session, const uint8_t* key_id, size_t key_id_length, uint8_t* key_control_block, size_t* key_control_block_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_QUERY_KEY_CONTROL); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -996,10 +919,6 @@ extern "C" OEMCryptoResult OEMCrypto_QueryKeyControl( extern "C" OEMCryptoResult OEMCrypto_SelectKey(const OEMCrypto_SESSION session, const uint8_t* key_id, size_t key_id_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_SELECT_KEY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1012,12 +931,6 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC( OEMCrypto_DestBufferDesc* out_buffer, const OEMCrypto_CENCEncryptPatternDesc* pattern, uint8_t subsample_flags) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_DECRYPT_CENC); - - ps.meta_data_.WriteVLV(static_cast(data_length)); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1045,10 +958,6 @@ extern "C" OEMCryptoResult OEMCrypto_WrapKeybox(const uint8_t* keybox, size_t* wrappedKeyBoxLength, const uint8_t* transportKey, size_t transportKeyLength) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_WRAP_KEYBOX); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(kLevelDefault); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1062,10 +971,6 @@ extern "C" OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox, } extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox() { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_LOAD_TEST_KEYBOX); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(kLevelDefault); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1085,8 +990,6 @@ extern "C" OEMCryptoResult OEMCrypto_GetOEMPublicCertificate( OEMCrypto_SESSION session, uint8_t *public_cert, size_t *public_cert_length) { - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GET_OEM_PUBLIC_CERTIFICATE); if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1107,10 +1010,6 @@ extern "C" OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData, extern "C" OEMCryptoResult OEMCrypto_GetRandom(uint8_t* randomData, size_t dataLength) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GET_RANDOM); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(kLevelDefault); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1127,8 +1026,6 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey30( const uint8_t* enc_rsa_key_iv, uint8_t* wrapped_rsa_key, size_t* wrapped_rsa_key_length) { - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY_30); if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1147,10 +1044,6 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey( const uint8_t* enc_rsa_key, size_t enc_rsa_key_length, const uint8_t* enc_rsa_key_iv, uint8_t* wrapped_rsa_key, size_t* wrapped_rsa_key_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1163,10 +1056,6 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey( extern "C" OEMCryptoResult OEMCrypto_LoadDeviceRSAKey( OEMCrypto_SESSION session, const uint8_t* wrapped_rsa_key, size_t wrapped_rsa_key_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_LOAD_DEVICE_RSA_KEY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1175,10 +1064,6 @@ extern "C" OEMCryptoResult OEMCrypto_LoadDeviceRSAKey( } extern "C" OEMCryptoResult OEMCrypto_LoadTestRSAKey() { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_LOAD_TEST_RSA_KEY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn = kAdapter->get(kLevelDefault); if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1190,10 +1075,6 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateRSASignature( OEMCrypto_SESSION session, const uint8_t* message, size_t message_length, uint8_t* signature, size_t* signature_length, RSA_Padding_Scheme padding_scheme) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_RSA_SIGNATURE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1212,10 +1093,6 @@ extern "C" OEMCryptoResult OEMCrypto_DeriveKeysFromSessionKey( size_t enc_session_key_length, const uint8_t* mac_key_context, size_t mac_key_context_length, const uint8_t* enc_key_context, size_t enc_key_context_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_DERIVE_KEYS_FROM_SESSION_KEY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1260,10 +1137,6 @@ extern "C" OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(size_t* maximum) { extern "C" OEMCryptoResult OEMCrypto_Generic_Encrypt( OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length, const uint8_t* iv, OEMCrypto_Algorithm algorithm, uint8_t* out_buffer) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_ENCRYPT); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1289,10 +1162,6 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Encrypt( extern "C" OEMCryptoResult OEMCrypto_Generic_Decrypt( OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length, const uint8_t* iv, OEMCrypto_Algorithm algorithm, uint8_t* out_buffer) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_DECRYPT); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1321,10 +1190,6 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Sign(OEMCrypto_SESSION session, OEMCrypto_Algorithm algorithm, uint8_t* signature, size_t* signature_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_SIGN); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1336,10 +1201,6 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Verify( OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length, OEMCrypto_Algorithm algorithm, const uint8_t* signature, size_t signature_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_VERIFY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1348,10 +1209,6 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Verify( } extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_UPDATE_USAGE_TABLE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault); const FunctionPointers* fcn3 = kAdapter->get(kLevel3); @@ -1363,10 +1220,6 @@ extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() { extern "C" OEMCryptoResult OEMCrypto_DeactivateUsageEntry(const uint8_t* pst, size_t pst_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_DEACTIVATE_USAGE_ENTRY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault); const FunctionPointers* fcn3 = kAdapter->get(kLevel3); @@ -1387,10 +1240,6 @@ extern "C" OEMCryptoResult OEMCrypto_ReportUsage(OEMCrypto_SESSION session, size_t pst_length, OEMCrypto_PST_Report* buffer, size_t* buffer_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_REPORT_USAGE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1406,10 +1255,6 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteUsageEntry( OEMCrypto_SESSION session, const uint8_t* pst, size_t pst_length, const uint8_t* message, size_t message_length, const uint8_t* signature, size_t signature_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_DELETE_USAGE_ENTRY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; LevelSession pair = kAdapter->get(session); if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION; @@ -1424,10 +1269,6 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteUsageEntry( extern "C" OEMCryptoResult OEMCrypto_ForceDeleteUsageEntry( const uint8_t* pst, size_t pst_length) { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_FORCE_DELETE_USAGE_ENTRY); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault); const FunctionPointers* fcn3 = kAdapter->get(kLevel3); @@ -1445,10 +1286,6 @@ extern "C" OEMCryptoResult OEMCrypto_ForceDeleteUsageEntry( } extern "C" OEMCryptoResult OEMCrypto_DeleteUsageTable() { - - wvcdm::oemprofiler::ProfiledScope ps( - wvcdm::oemprofiler::OEM_FUNCTION_DELETE_USAGE_TABLE); - if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE; const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault); const FunctionPointers* fcn3 = kAdapter->get(kLevel3); diff --git a/libwvdrmengine/cdm/profiler/include/call_history.h b/libwvdrmengine/cdm/profiler/include/call_history.h deleted file mode 100644 index 6ffee95a..00000000 --- a/libwvdrmengine/cdm/profiler/include/call_history.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_CALL_HISTORY_H_ -#define WVCDM_CALL_HISTORY_H_ - -#include -#include - -#include "circular_buffer.h" -#include "oem_functions.h" - -namespace wvcdm { -namespace oemprofiler { - -class CallHistory { - - public: - CallHistory(); - - void Write( - OEM_FUNCTION fid, - uint64_t start_time, - uint64_t end_time, - const uint8_t* meta_data, - size_t meta_data_length); - - void Read(std::vector& output) const; - - private: - CircularBuffer buffer_; - - uint64_t time_at_head_; - uint64_t time_at_tail_; - - bool RequestSpace(uint8_t num_bytes); - - bool ReadNextEntryRealEndTime(uint64_t* output); - - bool DropLastEntry(); - - // Read a variable length value. This is the read that matches - // EntryWriter's WriteVLV. - int ReadVLV(size_t offset, uint64_t* output) const; -}; - -} // namespace oemprofiler -} // namespace wvcdm - -#endif diff --git a/libwvdrmengine/cdm/profiler/include/circular_buffer.h b/libwvdrmengine/cdm/profiler/include/circular_buffer.h deleted file mode 100644 index c8451427..00000000 --- a/libwvdrmengine/cdm/profiler/include/circular_buffer.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_PROFILER_CIRCULAR_BUFFER_H_ -#define WVCDM_PROFILER_CIRCULAR_BUFFER_H_ - -#include -#include -#include - -namespace wvcdm { -namespace oemprofiler { - -class CircularBuffer { - public: - explicit CircularBuffer(size_t memoryBudget); - - size_t GetFreeSpace() const; - - size_t GetUsedSpace() const; - - // Add a series of bytes to the buffer. Values will remain in - // the buffer until Remove removes them. If there is not enough - // room for the full series, no bytes are written into the buffer. - bool AddU8s(const uint8_t* values, size_t numValues); - - // Add a single byte to the buffer. The value will remain in the - // buffer until Remove removes it. If the buffer is full, the - // byte will not be written into the buffer. - bool AddU8(uint8_t value); - - // Read a series of bytes without removing them. The start of the - // read is from the end (the oldest entry) + offset (toward the newest - // entry). If requested number of bytes is too large, no bytes are read - // and the function returns false. - bool PeekU8s(size_t offset, uint8_t* out, size_t numToRead) const; - - // Read a single byte without removing it. The read byte is at the index - // of the oldest entry + offset (toward the newest entry). If there are - // no bytes in the buffer the function returns false. - bool PeekU8(size_t offset, uint8_t* out) const; - - // Remove the requested number of bytes from the buffer from oldest - // to newest. If there are not enough bytes to remove, nothing is - // removed and the function returns false. - bool Remove(size_t numBytes); - - private: - std::vector buffer_; - - size_t fill_; - size_t head_; - size_t tail_; - - // disallow copy and assign - CircularBuffer(const CircularBuffer&); - void operator=(const CircularBuffer&); -}; - -} // namespace oemprofiler -} // namespace wvcdm - -#endif diff --git a/libwvdrmengine/cdm/profiler/include/entry_writer.h b/libwvdrmengine/cdm/profiler/include/entry_writer.h deleted file mode 100644 index 611f4b8c..00000000 --- a/libwvdrmengine/cdm/profiler/include/entry_writer.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_PROFILER_ENTRY_WRITER_H_ -#define WVCDM_PROFILER_ENTRY_WRITER_H_ - -#include -#include - -namespace wvcdm { -namespace oemprofiler { - -class EntryWriter { - public: - explicit EntryWriter(); - - const uint8_t* GetData() const; - - size_t GetSize() const; - - int WriteU8(uint8_t value); - - int WriteU16(uint16_t value); - - int WriteU32(uint32_t value); - - int WriteU64(uint64_t value); - - // WriteVLV - // Write a uint 64 value using a variable number of bytes. The number - // of bytes used is based on the number of bytes required to - // express the value. - // - // The first 3 bits are used to express the number of bytes - // (ranging 1 to 8 bytes). - // - // 1 byte = 0 to 31 - // 2 bytes = 32 to 8191 - // 3 bytes = 8192 to 2097151 - // 4 bytes = 2097152 to 536870911 - // 5 bytes = 536870912 to 137438953471 - // 6 bytes = 137438953472 to 35184372088831 - // 7 bytes = 35184372088832 to 9007199254740991 - // 8 bytes = 9007199254740992 to 2305843009213693951 - int WriteVLV(uint64_t value); - - void Clear(); - - size_t GetFreeSpace() const; - - private: - static const size_t kBufferSize = 32; - - uint8_t bytes_[kBufferSize]; - size_t write_head_; - - int Write(uint64_t v, size_t num_bytes); - - template - int Write(T v); - - uint8_t GetByte(uint64_t value, size_t byte_index); - - // disallow copy and assign - EntryWriter(const EntryWriter&); - void operator=(const EntryWriter&); -}; - -} // oemprofiler -} // wvcdm - -#endif diff --git a/libwvdrmengine/cdm/profiler/include/oem_functions.h b/libwvdrmengine/cdm/profiler/include/oem_functions.h deleted file mode 100644 index f071c296..00000000 --- a/libwvdrmengine/cdm/profiler/include/oem_functions.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_PROFILER_OEM_FUNCTIONS_H_ -#define WVCDM_PROFILER_OEM_FUNCTIONS_H_ - -namespace wvcdm { -namespace oemprofiler { - -enum OEM_FUNCTION { - OEM_FUNCTION_OPEN_SESSION = 0, - OEM_FUNCTION_COPY_BUFFER, - OEM_FUNCTION_INSTALL_KEYBOX, - OEM_FUNCTION_IS_KEYBOX_VALID, - OEM_FUNCTION_GET_DEVICE_ID, - OEM_FUNCTION_GET_KEY_DATA, - OEM_FUNCTION_API_VERSION, - OEM_FUNCTION_SECURITY_PATCH_LEVEL, - OEM_FUNCTION_SECURITY_LEVEL, - OEM_FUNCTION_GET_HDCP_CAPABILITIY, - OEM_FUNCTION_SUPPORTS_USAGE_TABLE, - OEM_FUNCTION_IS_ANTI_ROLLBACK_HW_PRESENT, - OEM_FUNCTION_GET_NUMBER_OF_OPEN_SESSIONS, - OEM_FUNCTION_GET_MAX_NUMBER_OF_SESSIONS, - OEM_FUNCTION_CLOSE_SESSION, - OEM_FUNCTION_GENERATE_DERIVED_KEYS, - OEM_FUNCTION_GENERATE_NONCE, - OEM_FUNCTION_GENERATE_SIGNATURE, - OEM_FUNCTION_LOAD_KEYS, - OEM_FUNCTION_REFRESH_KEYS, - OEM_FUNCTION_QUERY_KEY_CONTROL, - OEM_FUNCTION_SELECT_KEY, - OEM_FUNCTION_DECRYPT_CENC, - OEM_FUNCTION_WRAP_KEYBOX, - OEM_FUNCTION_LOAD_TEST_KEYBOX, - OEM_FUNCTION_GET_RANDOM, - OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY, - OEM_FUNCTION_LOAD_DEVICE_RSA_KEY, - OEM_FUNCTION_LOAD_TEST_RSA_KEY, - OEM_FUNCTION_GENERATE_RSA_SIGNATURE, - OEM_FUNCTION_DERIVE_KEYS_FROM_SESSION_KEY, - OEM_FUNCTION_GENERIC_ENCRYPT, - OEM_FUNCTION_GENERIC_DECRYPT, - OEM_FUNCTION_GENERIC_SIGN, - OEM_FUNCTION_GENERIC_VERIFY, - OEM_FUNCTION_UPDATE_USAGE_TABLE, - OEM_FUNCTION_DEACTIVATE_USAGE_ENTRY, - OEM_FUNCTION_REPORT_USAGE, - OEM_FUNCTION_DELETE_USAGE_ENTRY, - OEM_FUNCTION_FORCE_DELETE_USAGE_ENTRY, - OEM_FUNCTION_DELETE_USAGE_TABLE, - OEM_FUNCTION_GET_PROVISIONING_METHOD, - OEM_FUNCTION_GET_OEM_PUBLIC_CERTIFICATE, - OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY_30, - - OEM_FUNCTION_TESTING, // dummy value for testing purposes - OEM_FUNCTION_COUNT -}; - -} // namespace oemprofiler -} // namespace wvcdm - -#endif diff --git a/libwvdrmengine/cdm/profiler/include/profiled_scope.h b/libwvdrmengine/cdm/profiler/include/profiled_scope.h deleted file mode 100644 index b218ca49..00000000 --- a/libwvdrmengine/cdm/profiler/include/profiled_scope.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_PROFILER_PROFILED_SCOPE_H_ -#define WVCDM_PROFILER_PROFILED_SCOPE_H_ - -#include - -#include "entry_writer.h" -#include "oem_functions.h" - -namespace wvcdm { -namespace oemprofiler { - -class ProfiledScope { - public: - explicit ProfiledScope(OEM_FUNCTION fid); - ~ProfiledScope(); - - EntryWriter meta_data_; - - private: - OEM_FUNCTION fid_; - - uint64_t start_time_; - - void Submit(uint64_t end_time) const; - uint64_t GetNowUS() const; - - // disallow copy and assign - ProfiledScope(const ProfiledScope&); - void operator=(const ProfiledScope&); -}; - -} // namespace oemprofiler -} // namespace wvcdm -#endif diff --git a/libwvdrmengine/cdm/profiler/include/profiler.h b/libwvdrmengine/cdm/profiler/include/profiler.h deleted file mode 100644 index 2dc0c5bf..00000000 --- a/libwvdrmengine/cdm/profiler/include/profiler.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#ifndef WVCDM_PROFILER_H_ -#define WVCDM_PROFILER_H_ - -#include "call_history.h" - -namespace wvcdm { -namespace oemprofiler { - -class Profiler { - public: - static CallHistory& GetHistory(); - - private: - static CallHistory global_history_; -}; - -} // namespace oemprofiler -} // namespace wvcdm - -#endif diff --git a/libwvdrmengine/cdm/profiler/src/call_history.cpp b/libwvdrmengine/cdm/profiler/src/call_history.cpp deleted file mode 100644 index 534c4a7d..00000000 --- a/libwvdrmengine/cdm/profiler/src/call_history.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#include "call_history.h" - -#include - -#include "entry_writer.h" - -namespace wvcdm { -namespace oemprofiler { - -namespace { - const size_t kProfilingMemoryBudget = 64 * 1024; // 64 KB - const uint8_t kOutputVersionNumber = 0x00; -} - -CallHistory::CallHistory() : - buffer_(kProfilingMemoryBudget), - time_at_head_(0), - time_at_tail_(0) { - -} - -void CallHistory::Write( - OEM_FUNCTION fid, - uint64_t start_time, - uint64_t end_time, - const uint8_t* meta_data, - size_t meta_data_length) { - - // time_at_tail <= start_time <= end_time or else the subtraction - // will be invalid - if (start_time > end_time || start_time < time_at_tail_) { - LOGE("Skipping submission. Submission has time travelled." - "Start=%llu End=%llu Tail=%llu. Should be Tail<=Start<=End.", - start_time, end_time, time_at_tail_); - return; - } - - EntryWriter header; - header.WriteU8(fid); - header.WriteVLV(start_time - time_at_tail_); - header.WriteVLV(end_time - start_time); - - const size_t total_packet_size = header.GetSize() + meta_data_length; - - // The max size for a VLV is 8 bytes and the max size for a entry - // writer is 32 bytes. Normally the meta data will be packed using - // an entry writer so the max packet size will be 64 bytes. Since the - // packet size is encoded with a single byte, the packet must first - // be checked to ensure it is not too large for the cast. - if (total_packet_size <= 255 && RequestSpace(total_packet_size + 1)) { - buffer_.AddU8(static_cast(total_packet_size)); - buffer_.AddU8s(header.GetData(), header.GetSize()); - buffer_.AddU8s(meta_data, meta_data_length); - - time_at_tail_ = end_time; - } -} - -void CallHistory::Read(std::vector& output) const { - output.push_back(kOutputVersionNumber); - - // write the starting time - EntryWriter startingTimeWriter; - if (-1 == startingTimeWriter.WriteVLV(time_at_head_)) { - output.clear(); - return; - } - - for (size_t i = 0; i < startingTimeWriter.GetSize(); i++) { - output.push_back(startingTimeWriter.GetData()[i]); - } - - // write the whole circular buffer into the output buffer - const size_t num_bytes = buffer_.GetUsedSpace(); - for (size_t i = 0; i < num_bytes; i++) { - uint8_t b; - if (buffer_.PeekU8(i, &b)) { - output.push_back(b); - } - } -} - -bool CallHistory::RequestSpace(uint8_t num_bytes) { - // check if it is possible to make enough room - const size_t buffer_size = buffer_.GetFreeSpace() + - buffer_.GetUsedSpace(); - - if (num_bytes > buffer_size) { - LOGE("Requesting more space than possible (requested = %u, max = %zu)", - num_bytes, buffer_size); - return false; - } - - // drop entries until we have enough space - while (num_bytes > buffer_.GetFreeSpace() && DropLastEntry()); - - return num_bytes <= buffer_.GetFreeSpace(); -} - -bool CallHistory::ReadNextEntryRealEndTime(uint64_t* output) { - if (output == NULL) { - LOGE("Cannout output to null pointer"); - return false; - } - - size_t initial_time_start_index = 2; - - uint64_t initial_time; - const int initial_time_length = - ReadVLV(initial_time_start_index, &initial_time); - if (initial_time_length == -1) { - LOGE("Failed to read the start time for head entry"); - return false; - } - - uint64_t delta_time; - const int delta_time_length = ReadVLV( - initial_time_start_index + initial_time_length, &delta_time); - - if (delta_time_length == -1) { - LOGE("Failed to read the delta time for head entry"); - return false; - } - - *output = time_at_head_ + initial_time + delta_time; - return true; -} - -bool CallHistory::DropLastEntry() { - uint8_t entry_size; - uint64_t end_time; - - if (buffer_.PeekU8(0, &entry_size) && ReadNextEntryRealEndTime(&end_time)) { - // + 1 because the entry size byte needs to be removed too - if (buffer_.Remove(entry_size + 1)) { - time_at_head_ = end_time; - return true; - } - } - - return false; -} - -int CallHistory::ReadVLV(size_t offset, uint64_t* output) const { - uint8_t first_byte; - if (buffer_.PeekU8(offset, &first_byte)) { - const size_t num_bytes = (first_byte >> 5) + 1; - - uint64_t value = first_byte & 0x1F; - for (size_t i = 1; i < num_bytes; i++) { - uint8_t next_byte; - if (buffer_.PeekU8(offset + i, &next_byte)) { - value = value << 8 | next_byte; - } else { - return -1; - } - } - - *output = value; - return num_bytes; - } - - return -1; -} - -} // namespace wvcdm -} // namespace oemprofiler - diff --git a/libwvdrmengine/cdm/profiler/src/circular_buffer.cpp b/libwvdrmengine/cdm/profiler/src/circular_buffer.cpp deleted file mode 100644 index 3b86c346..00000000 --- a/libwvdrmengine/cdm/profiler/src/circular_buffer.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#include "circular_buffer.h" - -#include "log.h" - -namespace wvcdm { -namespace oemprofiler { - -CircularBuffer::CircularBuffer(size_t memory_budget) : - buffer_(memory_budget) { - - buffer_.resize(memory_budget, 0x00); - fill_ = head_ = tail_ = 0; -} - -size_t CircularBuffer::GetFreeSpace() const { - return buffer_.size() - fill_; -} - -size_t CircularBuffer::GetUsedSpace() const { - return fill_; -} - -bool CircularBuffer::AddU8(uint8_t value) { - return AddU8s(&value, 1); -} - -bool CircularBuffer::AddU8s(const uint8_t* values, size_t values_length) { - if (GetFreeSpace() < values_length) { - return false; - } - - for (size_t i = 0; i < values_length; i++) { - buffer_[head_] = values[i]; - head_ = (head_ + 1) % buffer_.size(); - } - - fill_ += values_length; - - return true; -} - -bool CircularBuffer::PeekU8s( - size_t offset, - uint8_t* out, - size_t read_length) const { - - if (out == NULL) { - LOGE("Cannot read to null output"); - return false; - } - - if (offset >= GetUsedSpace()) { - LOGE("Cannot read past end of data - %zu >= %zu", - offset, GetUsedSpace()); - - return false; - } - - if (read_length > GetUsedSpace() - offset) { - LOGE("Cannot read when there is not enough data - %zu >= %zu", - GetUsedSpace() - offset, sizeof(uint8_t)); - - return false; - } - - for (size_t i = 0; i < read_length; i++) { - const size_t safe_index = (tail_ + offset + i) % buffer_.size(); - out[i] = buffer_[safe_index]; - } - - return true; -} - -bool CircularBuffer::PeekU8(size_t offset, uint8_t* out) const { - return PeekU8s(offset, out, 1); -} - -bool CircularBuffer::Remove(size_t count) { - if (count > GetUsedSpace()) { - // can't remove more than there is - return false; - } - - fill_ -= count; - tail_ = (tail_ + count) % buffer_.size(); - return true; -} - -} // namespace oemprofiler -} // namespace wvcdm diff --git a/libwvdrmengine/cdm/profiler/src/entry_writer.cpp b/libwvdrmengine/cdm/profiler/src/entry_writer.cpp deleted file mode 100644 index 54e911b4..00000000 --- a/libwvdrmengine/cdm/profiler/src/entry_writer.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#include "entry_writer.h" -#include "log.h" - -namespace wvcdm { -namespace oemprofiler { - -static const uint64_t MAX_VALUES_FOR_BYTES[8] = { - 0x000000000000001F, - 0x0000000000001FFF, - 0x00000000001FFFFF, - 0x000000001FFFFFFF, - 0x0000001FFFFFFFFF, - 0x00001FFFFFFFFFFF, - 0x001FFFFFFFFFFFFF, - 0x1FFFFFFFFFFFFFFF - }; - -static const uint64_t CODE_FOR_BYTES[8] = { - 0x0000000000000000, - 0x0000000000002000, - 0x0000000000400000, - 0x0000000060000000, - 0x0000008000000000, - 0x0000A00000000000, - 0x00C0000000000000, - 0xE000000000000000 -}; - -EntryWriter::EntryWriter() : write_head_(0){ } - -const uint8_t* EntryWriter::GetData() const { return bytes_; } - -size_t EntryWriter::GetSize() const { return write_head_; } - -int EntryWriter::WriteU8(uint8_t value) { return Write(value); } - -int EntryWriter::WriteU16(uint16_t value) { return Write(value); } - -int EntryWriter::WriteU32(uint32_t value) { return Write(value); } - -int EntryWriter::WriteU64(uint64_t value) { return Write(value); } - -int EntryWriter::WriteVLV(uint64_t value) { - for (size_t i = 0; i < sizeof(uint64_t); i++) { - if (value <= MAX_VALUES_FOR_BYTES[i]) { - return Write(value | CODE_FOR_BYTES[i], i + 1); - } - } - - LOGE("writeVariableLengthValue - value too large for variable length value"); - return -1; -} - -int EntryWriter::Write(uint64_t v, size_t num_bytes) { - if (num_bytes > sizeof(uint64_t)) { - LOGE("read - cannot read %zu bytes when 8 bytes are the max", num_bytes); - return -1; - } - - if (GetFreeSpace() < num_bytes) { - LOGE("write - cannot write %zu when there are only %zu bytes remaining", - num_bytes, GetFreeSpace()); - return -1; - } - - for (int i = num_bytes; i > 0; i--) { - bytes_[write_head_] = GetByte(v, i - 1); - write_head_++; - } - - return static_cast(num_bytes); -} - -void EntryWriter::Clear() { - write_head_ = 0; -} - -size_t EntryWriter::GetFreeSpace() const { - return kBufferSize - write_head_; -} - -template -int EntryWriter::Write(T v) { - // start the values at index 1 so that the number of bytes - // line up with the shift value - static const size_t shifts[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; - - if (GetFreeSpace() < sizeof(T)) { - LOGE("write - cannot write %zu when there are only %zu bytes remaining", - sizeof(T), GetFreeSpace()); - return -1; // there is not enough room - } - - for (int i = sizeof(T) - 1; i >= 0; i--) { - bytes_[write_head_] = (uint8_t)((v >> shifts[i]) & 0xFF); - write_head_++; - } - - return (int)sizeof(T); -} - -uint8_t EntryWriter::GetByte(uint64_t value, size_t byte_index) { - return static_cast(0xFF & (value >> (byte_index * 8))); -} - -} // oem profiler -} // wvcdm diff --git a/libwvdrmengine/cdm/profiler/src/profiled_scope.cpp b/libwvdrmengine/cdm/profiler/src/profiled_scope.cpp deleted file mode 100644 index 93219db9..00000000 --- a/libwvdrmengine/cdm/profiler/src/profiled_scope.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved - -#include "profiled_scope.h" - -#include - -#include "profiler.h" - -namespace wvcdm { -namespace oemprofiler { - -ProfiledScope::ProfiledScope(OEM_FUNCTION fid) : - meta_data_(), - fid_(fid), - start_time_(GetNowUS()) { - -} - -ProfiledScope::~ProfiledScope() { - Submit(GetNowUS()); -} - -void ProfiledScope::Submit(uint64_t end_time) const { - - Profiler::GetHistory().Write( - fid_, - start_time_, - end_time, - meta_data_.GetData(), - meta_data_.GetSize()); -} - -uint64_t ProfiledScope::GetNowUS() const { - struct timeval tv; - gettimeofday(&tv, NULL); - - const uint64_t kSecondsToUSeconds = 1000000; - return static_cast(tv.tv_sec) * kSecondsToUSeconds + - static_cast(tv.tv_usec); -} - -} // namespace oemprofiler -} // namespace wvcdm diff --git a/libwvdrmengine/cdm/profiler/src/profiler.cpp b/libwvdrmengine/cdm/profiler/src/profiler.cpp deleted file mode 100644 index d5376810..00000000 --- a/libwvdrmengine/cdm/profiler/src/profiler.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 Google Inc. All Rights Reserved. - -#include "profiler.h" - -namespace wvcdm { -namespace oemprofiler { - -CallHistory Profiler::global_history_; - -CallHistory& Profiler::GetHistory() { - return global_history_; -} - -} // namespace wvcdm -} // namespace oemprofiler - diff --git a/libwvdrmengine/cdm/profiler/test/circular_buffer_test.cpp b/libwvdrmengine/cdm/profiler/test/circular_buffer_test.cpp deleted file mode 100644 index a7326497..00000000 --- a/libwvdrmengine/cdm/profiler/test/circular_buffer_test.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright 2015 Google Inc. All Rights Reserved. - -#include -#include - -#include "circular_buffer.h" - -namespace wvcdm { - -TEST(CircularBufferTest, MixAddU8AndU8s) { - oemprofiler::CircularBuffer buffer(32); - - const uint8_t expected_values[16] = { - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07 - }; - - ASSERT_TRUE(buffer.AddU8(expected_values[0])); - ASSERT_TRUE(buffer.AddU8(expected_values[1])); - ASSERT_TRUE(buffer.AddU8s(expected_values + 2, 6)); - - ASSERT_TRUE(buffer.AddU8(expected_values[8])); - ASSERT_TRUE(buffer.AddU8(expected_values[9])); - ASSERT_TRUE(buffer.AddU8s(expected_values + 10, 6)); - - uint8_t read[16]; - ASSERT_TRUE(buffer.PeekU8s(0, read, 16)); - - for (size_t i = 0; i < 16; i++) { - ASSERT_EQ(expected_values[i], read[i]); - } -} - -TEST(CircularBufferTest, MixPeekU8AndU8s) { - oemprofiler::CircularBuffer buffer(32); - - const uint8_t expected_values[16] = { - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07 - }; - - ASSERT_TRUE(buffer.AddU8s(expected_values, 16)); - - for (size_t i = 0; i < 2; i++) { - uint8_t read; - ASSERT_TRUE(buffer.PeekU8(i, &read)); - ASSERT_EQ(expected_values[i], read); - } - - { - uint8_t read[8]; - ASSERT_TRUE(buffer.PeekU8s(2, read, 8)); - - for (size_t i = 0; i < 8; i++) { - ASSERT_EQ(expected_values[i + 2], read[i]); - } - } - - for (size_t i = 10; i < 16; i++) { - uint8_t read; - ASSERT_TRUE(buffer.PeekU8(i, &read)); - ASSERT_EQ(expected_values[i], read); - } -} - -TEST(CircularBufferTest, ZeroSpaceBuffer) { - oemprofiler::CircularBuffer buffer(0); - - ASSERT_FALSE(buffer.AddU8(0)); - - const uint8_t values[4] = { 0x00, 0x01, 0x02, 0x03 }; - - ASSERT_FALSE(buffer.AddU8s(values, 4)); -} - -TEST(CircularBufferTest, AddU8sWithLengthZero) { - oemprofiler::CircularBuffer buffer(16); - - const uint8_t expected_values[16] = { - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07 - }; - - ASSERT_TRUE(buffer.AddU8s(expected_values, 0)); - - uint8_t read; - ASSERT_FALSE(buffer.PeekU8(0, &read)); -} - -TEST(CircularBufferTest, MeasureSpaceTest) { - oemprofiler::CircularBuffer buffer(16); - - ASSERT_EQ(16u, buffer.GetFreeSpace()); - ASSERT_EQ(0u, buffer.GetUsedSpace()); - - for (int i = 0; i < 16; i++) { - buffer.AddU8(0); - } - - ASSERT_EQ(0u, buffer.GetFreeSpace()); - ASSERT_EQ(16u, buffer.GetUsedSpace()); - - buffer.Remove(16); - - ASSERT_EQ(16u, buffer.GetFreeSpace()); - ASSERT_EQ(0u, buffer.GetUsedSpace()); -} - -TEST(CircularBufferTest, PeekAddU8Test) { - oemprofiler::CircularBuffer buffer(16); - - for (uint8_t i = 0; i < 16; i++) { - ASSERT_TRUE(buffer.AddU8(i)); - } - - for (uint8_t i = 0; i < 16; i++) { - uint8_t read; - ASSERT_TRUE(buffer.PeekU8(i, &read)); - ASSERT_EQ(i, read); - } - - ASSERT_EQ(16u, buffer.GetUsedSpace()); -} - -TEST(CircularBufferTest, PeekAddU8WrapTest) { - oemprofiler::CircularBuffer buffer(16); - - const uint8_t expected_values[] = { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - }; - - for (size_t i = 0; i < 16; i++) { - ASSERT_TRUE(buffer.AddU8(expected_values[i])); - } - - for (size_t i = 0; i < 16; i++) { - uint8_t read; - ASSERT_TRUE(buffer.PeekU8(i, &read)); - ASSERT_EQ(expected_values[i], read); - } - - ASSERT_EQ(16u, buffer.GetUsedSpace()); - buffer.Remove(8); - ASSERT_EQ(8u, buffer.GetUsedSpace()); - - for (size_t i = 0; i < 8; i++) { - const size_t expected_value_index = 8 + i; - const size_t buffer_index = i; - - uint8_t read; - ASSERT_TRUE(buffer.PeekU8(buffer_index, &read)); - ASSERT_EQ(expected_values[expected_value_index], read); - } - - for (size_t i = 16; i < 24; i++) { - ASSERT_TRUE(buffer.AddU8(expected_values[i])); - } - - for (size_t i = 0; i < 16; i++) { - const size_t expected_value_index = 8 + i; - const size_t buffer_index = i; - - uint8_t read; - buffer.PeekU8(buffer_index, &read); - - ASSERT_EQ(expected_values[expected_value_index], read); - } -} - -TEST(CircularBufferTest, OutOfRoomTest) { - oemprofiler::CircularBuffer buffer(16); - - for (int i = 0; i < 16; i++) { - ASSERT_TRUE(buffer.AddU8(i)); - } - - ASSERT_FALSE(buffer.AddU8(0)); -} - -TEST(CircularBufferTest, PassTailPeekTest) { - oemprofiler::CircularBuffer buffer(16); - - uint8_t read; - ASSERT_FALSE(buffer.PeekU8( 0, &read)); - ASSERT_FALSE(buffer.PeekU8(17, &read)); -} - -TEST(CircularBufferTest, NullOutputPeekTest) { - oemprofiler::CircularBuffer buffer(16); - buffer.AddU8(0); - - ASSERT_FALSE(buffer.PeekU8(0, nullptr)); -} - -TEST(CircularBufferTest, PeekAddU8sTest) { - oemprofiler::CircularBuffer buffer(16); - - const uint8_t data[] = { - 0, 1, 2, 3, - 4, 5, 6, 7, - 8, 9, 10, 11, - 12, 13, 14, 15 - }; - - ASSERT_TRUE(buffer.AddU8s(data, 16)); - - uint8_t read[16]; - ASSERT_TRUE(buffer.PeekU8s(0, read, 16)); - - for (uint8_t i = 0; i < 16; i++) { - ASSERT_EQ(i, read[i]); - } - - ASSERT_EQ(16u, buffer.GetUsedSpace()); -} - -} // namespace diff --git a/libwvdrmengine/cdm/profiler/test/entry_writer_test.cpp b/libwvdrmengine/cdm/profiler/test/entry_writer_test.cpp deleted file mode 100644 index f73f6165..00000000 --- a/libwvdrmengine/cdm/profiler/test/entry_writer_test.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2015 Google Inc. All Rights Reserved. - -#include -#include - -#include "entry_writer.h" - -namespace wvcdm { - -TEST(EntryWriterTest, ConstructorTest) { - oemprofiler::EntryWriter writer; - - ASSERT_TRUE(writer.GetData() != nullptr); - ASSERT_EQ(0u, writer.GetSize()); -} - -TEST(EntryWriterTest, WriteU8Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(1, writer.WriteU8(0x01)); - ASSERT_EQ(0x01u, writer.GetData()[0]); -} - -TEST(EntryWriterTest, WriteU16Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(2, writer.WriteU16(0x0102)); - ASSERT_EQ(0x01u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); -} - -TEST(EntryWriterTest, WriteU32Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(4, writer.WriteU32(0x01020304)); - ASSERT_EQ(0x01u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); -} - -TEST(EntryWriterTest, WriteU64Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(8, writer.WriteU64(0x0102030405060708)); - ASSERT_EQ(0x01u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); - ASSERT_EQ(0x05u, writer.GetData()[4]); - ASSERT_EQ(0x06u, writer.GetData()[5]); - ASSERT_EQ(0x07u, writer.GetData()[6]); - ASSERT_EQ(0x08u, writer.GetData()[7]); -} - -TEST(EntryWriterTest, WriteVLVAs8Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(1, writer.WriteVLV(0x01)); - ASSERT_EQ(0x01u, writer.GetData()[0]); -} - -TEST(EntryWriterTest, WriteVLVAs16Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(2, writer.WriteVLV(0x0102)); - ASSERT_EQ(0x01u | 0x20u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); -} - -TEST(EntryWriterTest, WriteVLVAs24Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(3, writer.WriteVLV(0x010203)); - ASSERT_EQ(0x01u | 0x40u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); -} - -TEST(EntryWriterTest, WriteVLVAs32Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(4, writer.WriteVLV(0x01020304)); - ASSERT_EQ(0x01u | 0x60u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); -} - -TEST(EntryWriterTest, WriteVLVAs40Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(5, writer.WriteVLV(0x0102030405)); - ASSERT_EQ(0x01u | 0x80u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); - ASSERT_EQ(0x05u, writer.GetData()[4]); -} - -TEST(EntryWriterTest, WriteVLVAs48Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(6, writer.WriteVLV(0x010203040506)); - ASSERT_EQ(0x01u | 0xA0u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); - ASSERT_EQ(0x05u, writer.GetData()[4]); - ASSERT_EQ(0x06u, writer.GetData()[5]); -} - -TEST(EntryWriterTest, WriteVLVAs56Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(7, writer.WriteVLV(0x01020304050607)); - ASSERT_EQ(0x01u | 0xC0u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); - ASSERT_EQ(0x05u, writer.GetData()[4]); - ASSERT_EQ(0x06u, writer.GetData()[5]); - ASSERT_EQ(0x07u, writer.GetData()[6]); -} - -TEST(EntryWriterTest, WriteVLVAs64Test) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(8, writer.WriteVLV(0x0102030405060708)); - ASSERT_EQ(0x01u | 0xE0u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); - ASSERT_EQ(0x05u, writer.GetData()[4]); - ASSERT_EQ(0x06u, writer.GetData()[5]); - ASSERT_EQ(0x07u, writer.GetData()[6]); - ASSERT_EQ(0x08u, writer.GetData()[7]); -} - -TEST(EntryWriterTest, ClearTest) { - oemprofiler::EntryWriter writer; - - ASSERT_EQ(0u, writer.GetSize()); - - ASSERT_EQ(1, writer.WriteU8(0x01)); - ASSERT_EQ(1u, writer.GetSize()); - - ASSERT_EQ(1, writer.WriteU8(0x02)); - ASSERT_EQ(2u, writer.GetSize()); - - ASSERT_EQ(1, writer.WriteU8(0x03)); - ASSERT_EQ(3u, writer.GetSize()); - - ASSERT_EQ(1, writer.WriteU8(0x04)); - ASSERT_EQ(4u, writer.GetSize()); - - writer.Clear(); - - ASSERT_EQ(0u, writer.GetSize()); - - //Clear should not clear the data form the buffer - ASSERT_EQ(0x01u, writer.GetData()[0]); - ASSERT_EQ(0x02u, writer.GetData()[1]); - ASSERT_EQ(0x03u, writer.GetData()[2]); - ASSERT_EQ(0x04u, writer.GetData()[3]); -} - -} // namespace diff --git a/libwvdrmengine/cdm/test/Android.mk b/libwvdrmengine/cdm/test/Android.mk index b83a3134..e764770f 100644 --- a/libwvdrmengine/cdm/test/Android.mk +++ b/libwvdrmengine/cdm/test/Android.mk @@ -67,13 +67,5 @@ test_name := timer_unittest test_src_dir := . include $(LOCAL_PATH)/unit-test.mk -test_name := circular_buffer_test -test_src_dir := ../profiler/test -include $(LOCAL_PATH)/unit-test.mk - -test_name := entry_writer_test -test_src_dir := ../profiler/test -include $(LOCAL_PATH)/unit-test.mk - test_name := test_src_dir := diff --git a/libwvdrmengine/mediadrm/Android.mk b/libwvdrmengine/mediadrm/Android.mk index 12b5704b..6038772a 100644 --- a/libwvdrmengine/mediadrm/Android.mk +++ b/libwvdrmengine/mediadrm/Android.mk @@ -10,7 +10,6 @@ LOCAL_C_INCLUDES := \ frameworks/native/include \ vendor/widevine/libwvdrmengine/cdm/core/include \ vendor/widevine/libwvdrmengine/cdm/include \ - vendor/widevine/libwvdrmengine/cdm/profiler/include \ vendor/widevine/libwvdrmengine/include \ vendor/widevine/libwvdrmengine/mediadrm/include \ vendor/widevine/libwvdrmengine/oemcrypto/include \ diff --git a/libwvdrmengine/mediadrm/include/WVDrmPlugin.h b/libwvdrmengine/mediadrm/include/WVDrmPlugin.h index 29998ddc..9f2ef560 100644 --- a/libwvdrmengine/mediadrm/include/WVDrmPlugin.h +++ b/libwvdrmengine/mediadrm/include/WVDrmPlugin.h @@ -274,14 +274,6 @@ class WVDrmPlugin : public android::DrmPlugin, status_t mapAndNotifyOfOEMCryptoResult(const Vector& sessionId, OEMCryptoResult res); - bool tryGettingOEMProfilingHistory( - const String8& name, - Vector& value) const; - - bool tryGettingOEMProfilingStats( - const String8& name, - Vector& value) const; - status_t mapOEMCryptoResult(OEMCryptoResult res); bool initDataResemblesPSSH(const Vector& initData); diff --git a/libwvdrmengine/mediadrm/src/WVDrmPlugin.cpp b/libwvdrmengine/mediadrm/src/WVDrmPlugin.cpp index 562b36b0..d60e0bb4 100644 --- a/libwvdrmengine/mediadrm/src/WVDrmPlugin.cpp +++ b/libwvdrmengine/mediadrm/src/WVDrmPlugin.cpp @@ -17,7 +17,6 @@ #include "mapErrors-inl.h" #include "media/stagefright/MediaErrors.h" -#include "profiler.h" #include "utils/Errors.h" #include "wv_cdm_constants.h" @@ -27,10 +26,6 @@ namespace { static const char* const kDisable = "disable"; static const std::string kPsshTag = "pssh"; static const char* const kSpecialUnprovisionResponse = "unprovision"; - - - // profiler proterties constants - static const android::String8 kProfilerHistoryTag("oemProfilerHistory"); } namespace wvdrm { @@ -497,26 +492,10 @@ status_t WVDrmPlugin::getPropertyString(const String8& name, return android::OK; } -bool WVDrmPlugin::tryGettingOEMProfilingHistory(const String8& name, - Vector& value) const { - - if (name == kProfilerHistoryTag) { - std::vector tempValue; - oemprofiler::Profiler::GetHistory().Read(tempValue); - value.appendArray(tempValue.data(), tempValue.size()); - - return true; - } - - return false; -} - status_t WVDrmPlugin::getPropertyByteArray(const String8& name, Vector& value) const { - if (tryGettingOEMProfilingHistory(name, value)) { - return android::OK; - } else if (name == "deviceUniqueId") { + if (name == "deviceUniqueId") { return queryProperty(QUERY_KEY_DEVICE_ID, value); } else if (name == "provisioningUniqueId") { return queryProperty(QUERY_KEY_PROVISIONING_ID, value); diff --git a/libwvdrmengine/mediadrm/test/Android.mk b/libwvdrmengine/mediadrm/test/Android.mk index 7cfdad42..10da1c03 100644 --- a/libwvdrmengine/mediadrm/test/Android.mk +++ b/libwvdrmengine/mediadrm/test/Android.mk @@ -8,7 +8,6 @@ LOCAL_C_INCLUDES := \ frameworks/av/include \ frameworks/native/include \ vendor/widevine/libwvdrmengine/cdm/core/include \ - vendor/widevine/libwvdrmengine/cdm/profiler/include \ vendor/widevine/libwvdrmengine/cdm/include \ vendor/widevine/libwvdrmengine/include \ vendor/widevine/libwvdrmengine/mediadrm/include \