Files
android/libwvdrmengine/cdm/src/ami_adapter.cpp
Adam Stone a0da1f067b Support GetPropertyByteArray for getting metrics.
Adds support for GetPropertyByteArray to return a serialized set of metrics
to the caller. This should be the last part of the widevine plugin
changes that fix the referenced bug.  More changes are coming on the
MediaDrm side.

This is a merge of wvgerrit/28422

I intend to submit 2048751, 2048750, and 2048509 together.

Bug: 36217927
Test: Added additional unit tests for affected code.
Change-Id: I2618c2be48d7d780127e35f237e2276efd080879
2017-06-20 03:09:59 +00:00

68 lines
1.7 KiB
C++

// Copyright 2017 Google Inc. All Rights Reserved.
#include "ami_adapter.h"
#include <log.h>
namespace wvcdm {
AmiAdapter::AmiAdapter() :
analytics_item_("widevine") {
analytics_item_.generateSessionID();
}
AmiAdapter::AmiAdapter(int64_t parent) :
analytics_item_("widevine") {
analytics_item_.generateSessionID();
analytics_item_.setInt64("/drm/widevine/parent/external", parent);
}
AmiAdapter::~AmiAdapter() {
analytics_item_.setFinalized(true);
analytics_item_.selfrecord();
}
void AmiAdapter::UpdateString(const std::string& metric_id,
const std::string& value) {
analytics_item_.setCString(metric_id.c_str(), value.c_str());
LOGV(
"AmiAdapter (%lld) %s : %s",
analytics_item_.getSessionID(),
metric_id.c_str(),
value.c_str());
}
void AmiAdapter::UpdateInt32(const std::string& metric_id,
int32_t value) {
analytics_item_.setInt32(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %ld",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
}
void AmiAdapter::UpdateInt64(const std::string& metric_id,
int64_t value) {
analytics_item_.setInt64(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %lld",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
}
void AmiAdapter::UpdateDouble(const std::string& metric_id,
double value) {
analytics_item_.setDouble(metric_id.c_str(), value);
LOGV(
"AmiAdapter (%lld) %s : %f",
analytics_item_.getSessionID(),
metric_id.c_str(),
value);
}
} // namespace wvcdm