OEMCrypto Profiler - Merge of Widevine Updates

This change is a merge of the following changes:
1. Remove MultipleSessions (go/wvgerrit/16763)
2. Increase Memory Budget (go/wvgerrit/16764)
3. Fixing Possible Integer Overflow (go/wvgerrit/16765)
4. Creating Call Table (go/wvgerrit/16766)
5. Creating Call History (go/wvgerrit/16767)
6. Connecting Profiled Scope (go/wvgerrit/16768)
7. Adding Call Table Version Number (go/wvgerrit/16780)
8. Add Version Number to Call History (go/wvgerrit/16781)

bug: 27157796

Change-Id: Ia3f088a1714f3f5b426fee6141daa4ea8d832cf4
This commit is contained in:
Aaron Vaage
2016-02-12 15:43:37 -08:00
committed by Jeff Tinker
parent 9c82455e8f
commit 0d77fecfb5
12 changed files with 457 additions and 153 deletions

View File

@@ -17,7 +17,7 @@
#include "mapErrors-inl.h"
#include "media/stagefright/MediaErrors.h"
#include "profiled_scope.h"
#include "profiler.h"
#include "utils/Errors.h"
#include "wv_cdm_constants.h"
@@ -30,8 +30,8 @@ namespace {
// profiler proterties constants
static const android::String8 kProfilerHistoryTag("oemProfilerHistory-");
static const android::String8 kProfilerStatsTag("oemProfilerStats-");
static const android::String8 kProfilerHistoryTag("oemProfilerHistory");
static const android::String8 kProfilerStatsTag("oemProfilerStats");
}
namespace wvdrm {
@@ -498,84 +498,33 @@ 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
if (name == kProfilerHistoryTag) {
std::vector<uint8_t> tempValue;
session->ReadHistory(tempValue);
oemprofiler::Profiler::GetHistory().Read(tempValue);
value.appendArray(tempValue.data(), tempValue.size());
return true;
}
return false;
}
bool WVDrmPlugin::tryGettingOEMProfilingStats(
const String8& name,
Vector<uint8_t>& value) const {
oemprofiler::ProfilerSession* session = nullptr;
if (name == kProfilerStatsTag) {
std::vector<uint8_t> tempValue;
oemprofiler::Profiler::GetTable().Read(tempValue);
value.appendArray(tempValue.data(), tempValue.size());
if (!tryGettingSessionFromPropertyName(
name, kProfilerStatsTag, &session)) {
return false;
return true;
}
std::vector<uint8_t> tempValue;
session->ReadAllStats(tempValue);
value.appendArray(tempValue.data(), tempValue.size());
return true;
return false;
}
status_t WVDrmPlugin::getPropertyByteArray(const String8& name,