OEMCrypto Profiler
This CL is a merge from the widevine repo of: http://go/wvgerrit/16491 Circular Buffer http://go/wvgerrit/16512 Circular Buffer Tests http://go/wvgerrit/16493 Entry Writer http://go/wvgerrit/16495 Profiled Scope http://go/wvgerrit/16500 Stats Collection http://go/wvgerrit/16543 Disallow Stats Copy or Assign http://go/wvgerrit/16514 Moving OEM Function Enum http://go/wvgerrit/16501 Defining Session Interface http://go/wvgerrit/16502 Session Definitions http://go/wvgerrit/16573 Remove code to num bytes table http://go/wvgerrit/16556 Connecting Profiler to Profiled Scope http://go/wvgerrit/16557 Android Reading Profiler History http://go/wvgerrit/16574 Adding Get Stats Method http://go/wvgerrit/16606 Seperating Session Parsing http://go/wvgerrit/16607 Adding get stats method to DRMPlugin http://go/wvgerrit/16608 Fixing Linux Build Failure http://go/wvgerrit/16612 Stop Clearing History http://go/wvgerrit/16613 Accessing profiler information using session id http://go/wvgerrit/16614 Making All Session Subsets of Global Session BUG: 25123303 BUG: 26027857 Change-Id: Ie2422e644aa631871852ea0e461695aeb7060f88
This commit is contained in:
@@ -10,6 +10,7 @@ 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 \
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "media/stagefright/foundation/ABase.h"
|
||||
#include "media/stagefright/foundation/AString.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "profiler_session.h"
|
||||
#include "utils/Errors.h"
|
||||
#include "utils/KeyedVector.h"
|
||||
#include "utils/List.h"
|
||||
@@ -274,6 +275,19 @@ class WVDrmPlugin : public android::DrmPlugin,
|
||||
status_t mapAndNotifyOfOEMCryptoResult(const Vector<uint8_t>& sessionId,
|
||||
OEMCryptoResult res);
|
||||
|
||||
bool tryGettingSessionFromPropertyName(
|
||||
const String8& name,
|
||||
const String8& tag,
|
||||
wvcdm::oemprofiler::ProfilerSession** out) const;
|
||||
|
||||
bool tryGettingOEMProfilingHistory(
|
||||
const String8& name,
|
||||
Vector<uint8_t>& value) const;
|
||||
|
||||
bool tryGettingOEMProfilingStats(
|
||||
const String8& name,
|
||||
Vector<uint8_t>& value) const;
|
||||
|
||||
status_t mapOEMCryptoResult(OEMCryptoResult res);
|
||||
|
||||
bool initDataResemblesPSSH(const Vector<uint8_t>& initData);
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include <endian.h>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mapErrors-inl.h"
|
||||
#include "media/stagefright/MediaErrors.h"
|
||||
#include "profiled_scope.h"
|
||||
#include "utils/Errors.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
@@ -25,6 +27,11 @@ 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-");
|
||||
static const android::String8 kProfilerStatsTag("oemProfilerStats-");
|
||||
}
|
||||
|
||||
namespace wvdrm {
|
||||
@@ -492,9 +499,94 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
|
||||
return android::OK;
|
||||
}
|
||||
|
||||
bool WVDrmPlugin::tryGettingSessionFromPropertyName(
|
||||
const String8& name,
|
||||
const String8& tag,
|
||||
oemprofiler::ProfilerSession** out) const {
|
||||
|
||||
if (name.find(tag) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
oemprofiler::ProfilerSession* session = NULL;
|
||||
|
||||
// if the name starts with the tag and is the same length
|
||||
// as the tag, then it must just be the tag
|
||||
if (name.length() == tag.length()) {
|
||||
// if it is just the tag, then return the global session
|
||||
session = oemprofiler::ProfilerSession::Find(
|
||||
oemprofiler::ProfiledScope::kGlobalSID);
|
||||
} else {
|
||||
// make a string that is only the part that comes after the tag.
|
||||
// If it is a valid property, this should be a cdm session id
|
||||
const CdmSessionId cdm_session_id(name.string() + tag.length());
|
||||
|
||||
if (mCryptoSessions.count(cdm_session_id) != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const OEMCrypto_SESSION sid =
|
||||
mCryptoSessions.at(cdm_session_id).oecSessionId();
|
||||
|
||||
session = oemprofiler::ProfilerSession::Find(static_cast<int64_t>(sid));
|
||||
}
|
||||
|
||||
// if the session is not open, then treat the property as not existing
|
||||
if (session == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (out != nullptr) {
|
||||
*out = session;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WVDrmPlugin::tryGettingOEMProfilingHistory(const String8& name,
|
||||
Vector<uint8_t>& value) const {
|
||||
|
||||
oemprofiler::ProfilerSession* session = nullptr;
|
||||
|
||||
if (!tryGettingSessionFromPropertyName(
|
||||
name, kProfilerHistoryTag, &session)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// read the data out of the session
|
||||
std::vector<uint8_t> tempValue;
|
||||
session->ReadHistory(tempValue);
|
||||
value.appendArray(tempValue.data(), tempValue.size());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WVDrmPlugin::tryGettingOEMProfilingStats(
|
||||
const String8& name,
|
||||
Vector<uint8_t>& value) const {
|
||||
|
||||
oemprofiler::ProfilerSession* session = nullptr;
|
||||
|
||||
if (!tryGettingSessionFromPropertyName(
|
||||
name, kProfilerStatsTag, &session)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<uint8_t> tempValue;
|
||||
session->ReadAllStats(tempValue);
|
||||
value.appendArray(tempValue.data(), tempValue.size());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getPropertyByteArray(const String8& name,
|
||||
Vector<uint8_t>& value) const {
|
||||
if (name == "deviceUniqueId") {
|
||||
|
||||
if (tryGettingOEMProfilingHistory(name, value)) {
|
||||
return android::OK;
|
||||
} else if (tryGettingOEMProfilingStats(name, value)) {
|
||||
return android::OK;
|
||||
} else if (name == "deviceUniqueId") {
|
||||
return queryProperty(QUERY_KEY_DEVICE_ID, value);
|
||||
} else if (name == "provisioningUniqueId") {
|
||||
return queryProperty(QUERY_KEY_PROVISIONING_ID, value);
|
||||
|
||||
Reference in New Issue
Block a user