Naming consistency: MediaAnalytics to MediaMetrics
Bug: 145780674
Test: build, boot, dumpsys media.metrics
Test: atest mediametrics_tests CtsNativeMediaMetricsTestCases
Change-Id: Icbfa98da9e61702aee9a1d807b5e126b4b9c6458
diff --git a/drm/drmserver/DrmManager.cpp b/drm/drmserver/DrmManager.cpp
index e2ea83a..38dc052 100644
--- a/drm/drmserver/DrmManager.cpp
+++ b/drm/drmserver/DrmManager.cpp
@@ -31,7 +31,7 @@
#include <drm/DrmInfoRequest.h>
#include <drm/DrmSupportInfo.h>
#include <drm/DrmConvertedStatus.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <IDrmEngine.h>
#include "DrmManager.h"
@@ -58,7 +58,7 @@
const char func[], const String8& plugInId, const String8& mimeType) {
IDrmEngine& engine = mPlugInManager.getPlugIn(plugInId);
- std::unique_ptr<MediaAnalyticsItem> item(MediaAnalyticsItem::create("drmmanager"));
+ std::unique_ptr<mediametrics::Item> item(mediametrics::Item::create("drmmanager"));
item->setUid(IPCThreadState::self()->getCallingUid());
item->setCString("function_name", func);
item->setCString("plugin_id", plugInId.getPathLeaf().getBasePath().c_str());
diff --git a/include/media/IMediaAnalyticsService.h b/include/media/IMediaAnalyticsService.h
deleted file mode 120000
index a596d60..0000000
--- a/include/media/IMediaAnalyticsService.h
+++ /dev/null
@@ -1 +0,0 @@
-../../media/libmediametrics/include/IMediaAnalyticsService.h
\ No newline at end of file
diff --git a/include/media/IMediaMetricsService.h b/include/media/IMediaMetricsService.h
new file mode 120000
index 0000000..84b99ee
--- /dev/null
+++ b/include/media/IMediaMetricsService.h
@@ -0,0 +1 @@
+../../media/libmediametrics/include/IMediaMetricsService.h
\ No newline at end of file
diff --git a/include/media/MediaAnalyticsItem.h b/include/media/MediaAnalyticsItem.h
deleted file mode 120000
index e8124e0..0000000
--- a/include/media/MediaAnalyticsItem.h
+++ /dev/null
@@ -1 +0,0 @@
-../../media/libmediametrics/include/MediaAnalyticsItem.h
\ No newline at end of file
diff --git a/include/media/MediaMetricsItem.h b/include/media/MediaMetricsItem.h
new file mode 120000
index 0000000..5438953
--- /dev/null
+++ b/include/media/MediaMetricsItem.h
@@ -0,0 +1 @@
+../../media/libmediametrics/include/MediaMetricsItem.h
\ No newline at end of file
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index c22db59..2494313 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -32,7 +32,7 @@
#include <private/media/AudioTrackShared.h>
#include <processgroup/sched_policy.h>
#include <media/IAudioFlinger.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/TypeConverter.h>
#define WAIT_PERIOD_MS 10
@@ -79,37 +79,37 @@
#define MM_PREFIX "android.media.audiorecord." // avoid cut-n-paste errors.
// Java API 28 entries, do not change.
- mAnalyticsItem->setCString(MM_PREFIX "encoding", toString(record->mFormat).c_str());
- mAnalyticsItem->setCString(MM_PREFIX "source", toString(record->mAttributes.source).c_str());
- mAnalyticsItem->setInt32(MM_PREFIX "latency", (int32_t)record->mLatency); // bad estimate.
- mAnalyticsItem->setInt32(MM_PREFIX "samplerate", (int32_t)record->mSampleRate);
- mAnalyticsItem->setInt32(MM_PREFIX "channels", (int32_t)record->mChannelCount);
+ mMetricsItem->setCString(MM_PREFIX "encoding", toString(record->mFormat).c_str());
+ mMetricsItem->setCString(MM_PREFIX "source", toString(record->mAttributes.source).c_str());
+ mMetricsItem->setInt32(MM_PREFIX "latency", (int32_t)record->mLatency); // bad estimate.
+ mMetricsItem->setInt32(MM_PREFIX "samplerate", (int32_t)record->mSampleRate);
+ mMetricsItem->setInt32(MM_PREFIX "channels", (int32_t)record->mChannelCount);
// Non-API entries, these can change.
- mAnalyticsItem->setInt32(MM_PREFIX "portId", (int32_t)record->mPortId);
- mAnalyticsItem->setInt32(MM_PREFIX "frameCount", (int32_t)record->mFrameCount);
- mAnalyticsItem->setCString(MM_PREFIX "attributes", toString(record->mAttributes).c_str());
- mAnalyticsItem->setInt64(MM_PREFIX "channelMask", (int64_t)record->mChannelMask);
+ mMetricsItem->setInt32(MM_PREFIX "portId", (int32_t)record->mPortId);
+ mMetricsItem->setInt32(MM_PREFIX "frameCount", (int32_t)record->mFrameCount);
+ mMetricsItem->setCString(MM_PREFIX "attributes", toString(record->mAttributes).c_str());
+ mMetricsItem->setInt64(MM_PREFIX "channelMask", (int64_t)record->mChannelMask);
// log total duration recording, including anything currently running.
int64_t activeNs = 0;
if (mStartedNs != 0) {
activeNs = systemTime() - mStartedNs;
}
- mAnalyticsItem->setDouble(MM_PREFIX "durationMs", (mDurationNs + activeNs) * 1e-6);
- mAnalyticsItem->setInt64(MM_PREFIX "startCount", (int64_t)mCount);
+ mMetricsItem->setDouble(MM_PREFIX "durationMs", (mDurationNs + activeNs) * 1e-6);
+ mMetricsItem->setInt64(MM_PREFIX "startCount", (int64_t)mCount);
if (mLastError != NO_ERROR) {
- mAnalyticsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError);
- mAnalyticsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str());
+ mMetricsItem->setInt32(MM_PREFIX "lastError.code", (int32_t)mLastError);
+ mMetricsItem->setCString(MM_PREFIX "lastError.at", mLastErrorFunc.c_str());
}
}
// hand the user a snapshot of the metrics.
-status_t AudioRecord::getMetrics(MediaAnalyticsItem * &item)
+status_t AudioRecord::getMetrics(mediametrics::Item * &item)
{
mMediaMetrics.gather(this);
- MediaAnalyticsItem *tmp = mMediaMetrics.dup();
+ mediametrics::Item *tmp = mMediaMetrics.dup();
if (tmp == nullptr) {
return BAD_VALUE;
}
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index e8d7b60..3151feb 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -35,7 +35,7 @@
#include <media/AudioParameter.h>
#include <media/AudioResamplerPublic.h>
#include <media/AudioSystem.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/TypeConverter.h>
#define WAIT_PERIOD_MS 10
@@ -183,26 +183,26 @@
#define MM_PREFIX "android.media.audiotrack." // avoid cut-n-paste errors.
// Java API 28 entries, do not change.
- mAnalyticsItem->setCString(MM_PREFIX "streamtype", toString(track->streamType()).c_str());
- mAnalyticsItem->setCString(MM_PREFIX "type",
+ mMetricsItem->setCString(MM_PREFIX "streamtype", toString(track->streamType()).c_str());
+ mMetricsItem->setCString(MM_PREFIX "type",
toString(track->mAttributes.content_type).c_str());
- mAnalyticsItem->setCString(MM_PREFIX "usage", toString(track->mAttributes.usage).c_str());
+ mMetricsItem->setCString(MM_PREFIX "usage", toString(track->mAttributes.usage).c_str());
// Non-API entries, these can change due to a Java string mistake.
- mAnalyticsItem->setInt32(MM_PREFIX "sampleRate", (int32_t)track->mSampleRate);
- mAnalyticsItem->setInt64(MM_PREFIX "channelMask", (int64_t)track->mChannelMask);
+ mMetricsItem->setInt32(MM_PREFIX "sampleRate", (int32_t)track->mSampleRate);
+ mMetricsItem->setInt64(MM_PREFIX "channelMask", (int64_t)track->mChannelMask);
// Non-API entries, these can change.
- mAnalyticsItem->setInt32(MM_PREFIX "portId", (int32_t)track->mPortId);
- mAnalyticsItem->setCString(MM_PREFIX "encoding", toString(track->mFormat).c_str());
- mAnalyticsItem->setInt32(MM_PREFIX "frameCount", (int32_t)track->mFrameCount);
- mAnalyticsItem->setCString(MM_PREFIX "attributes", toString(track->mAttributes).c_str());
+ mMetricsItem->setInt32(MM_PREFIX "portId", (int32_t)track->mPortId);
+ mMetricsItem->setCString(MM_PREFIX "encoding", toString(track->mFormat).c_str());
+ mMetricsItem->setInt32(MM_PREFIX "frameCount", (int32_t)track->mFrameCount);
+ mMetricsItem->setCString(MM_PREFIX "attributes", toString(track->mAttributes).c_str());
}
// hand the user a snapshot of the metrics.
-status_t AudioTrack::getMetrics(MediaAnalyticsItem * &item)
+status_t AudioTrack::getMetrics(mediametrics::Item * &item)
{
mMediaMetrics.gather(this);
- MediaAnalyticsItem *tmp = mMediaMetrics.dup();
+ mediametrics::Item *tmp = mMediaMetrics.dup();
if (tmp == nullptr) {
return BAD_VALUE;
}
diff --git a/media/libaudioclient/include/media/AudioRecord.h b/media/libaudioclient/include/media/AudioRecord.h
index a3c0fe4..db90e6a 100644
--- a/media/libaudioclient/include/media/AudioRecord.h
+++ b/media/libaudioclient/include/media/AudioRecord.h
@@ -24,7 +24,7 @@
#include <cutils/sched_policy.h>
#include <media/AudioSystem.h>
#include <media/AudioTimestamp.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/Modulo.h>
#include <media/MicrophoneInfo.h>
#include <media/RecordingActivityTracker.h>
@@ -270,7 +270,7 @@
/*
* return metrics information for the current instance.
*/
- status_t getMetrics(MediaAnalyticsItem * &item);
+ status_t getMetrics(mediametrics::Item * &item);
/* After it's created the track is not active. Call start() to
* make it active. If set, the callback will start being called.
@@ -733,27 +733,27 @@
private:
class MediaMetrics {
public:
- MediaMetrics() : mAnalyticsItem(MediaAnalyticsItem::create("audiorecord")),
+ MediaMetrics() : mMetricsItem(mediametrics::Item::create("audiorecord")),
mCreatedNs(systemTime(SYSTEM_TIME_REALTIME)),
mStartedNs(0), mDurationNs(0), mCount(0),
mLastError(NO_ERROR) {
}
~MediaMetrics() {
- // mAnalyticsItem alloc failure will be flagged in the constructor
+ // mMetricsItem alloc failure will be flagged in the constructor
// don't log empty records
- if (mAnalyticsItem->count() > 0) {
- mAnalyticsItem->selfrecord();
+ if (mMetricsItem->count() > 0) {
+ mMetricsItem->selfrecord();
}
}
void gather(const AudioRecord *record);
- MediaAnalyticsItem *dup() { return mAnalyticsItem->dup(); }
+ mediametrics::Item *dup() { return mMetricsItem->dup(); }
void logStart(nsecs_t when) { mStartedNs = when; mCount++; }
void logStop(nsecs_t when) { mDurationNs += (when-mStartedNs); mStartedNs = 0;}
void markError(status_t errcode, const char *func)
{ mLastError = errcode; mLastErrorFunc = func;}
private:
- std::unique_ptr<MediaAnalyticsItem> mAnalyticsItem;
+ std::unique_ptr<mediametrics::Item> mMetricsItem;
nsecs_t mCreatedNs; // XXX: perhaps not worth it in production
nsecs_t mStartedNs;
nsecs_t mDurationNs;
diff --git a/media/libaudioclient/include/media/AudioTrack.h b/media/libaudioclient/include/media/AudioTrack.h
index df5eabc..cfbce03 100644
--- a/media/libaudioclient/include/media/AudioTrack.h
+++ b/media/libaudioclient/include/media/AudioTrack.h
@@ -22,7 +22,7 @@
#include <media/AudioTimestamp.h>
#include <media/IAudioTrack.h>
#include <media/AudioResamplerPublic.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/Modulo.h>
#include <utils/threads.h>
@@ -400,7 +400,7 @@
/*
* return metrics information for the current track.
*/
- status_t getMetrics(MediaAnalyticsItem * &item);
+ status_t getMetrics(mediametrics::Item * &item);
/* After it's created the track is not active. Call start() to
* make it active. If set, the callback will start being called.
@@ -1230,19 +1230,19 @@
private:
class MediaMetrics {
public:
- MediaMetrics() : mAnalyticsItem(MediaAnalyticsItem::create("audiotrack")) {
+ MediaMetrics() : mMetricsItem(mediametrics::Item::create("audiotrack")) {
}
~MediaMetrics() {
- // mAnalyticsItem alloc failure will be flagged in the constructor
+ // mMetricsItem alloc failure will be flagged in the constructor
// don't log empty records
- if (mAnalyticsItem->count() > 0) {
- mAnalyticsItem->selfrecord();
+ if (mMetricsItem->count() > 0) {
+ mMetricsItem->selfrecord();
}
}
void gather(const AudioTrack *track);
- MediaAnalyticsItem *dup() { return mAnalyticsItem->dup(); }
+ mediametrics::Item *dup() { return mMetricsItem->dup(); }
private:
- std::unique_ptr<MediaAnalyticsItem> mAnalyticsItem;
+ std::unique_ptr<mediametrics::Item> mMetricsItem;
};
MediaMetrics mMediaMetrics;
};
diff --git a/media/libmedia/include/media/CounterMetric.h b/media/libmedia/include/media/CounterMetric.h
index b53470d..8bd4049 100644
--- a/media/libmedia/include/media/CounterMetric.h
+++ b/media/libmedia/include/media/CounterMetric.h
@@ -20,7 +20,7 @@
#include <map>
#include <string>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <utils/Log.h>
namespace android {
diff --git a/media/libmedia/include/media/EventMetric.h b/media/libmedia/include/media/EventMetric.h
index dbb736a..d6f3402 100644
--- a/media/libmedia/include/media/EventMetric.h
+++ b/media/libmedia/include/media/EventMetric.h
@@ -16,7 +16,7 @@
#ifndef ANDROID_EVENT_METRIC_H_
#define ANDROID_EVENT_METRIC_H_
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <utils/Timers.h>
namespace android {
diff --git a/media/libmediametrics/Android.bp b/media/libmediametrics/Android.bp
index f599190..7fd5408 100644
--- a/media/libmediametrics/Android.bp
+++ b/media/libmediametrics/Android.bp
@@ -2,8 +2,8 @@
name: "libmediametrics",
srcs: [
- "IMediaAnalyticsService.cpp",
- "MediaAnalyticsItem.cpp",
+ "IMediaMetricsService.cpp",
+ "MediaMetricsItem.cpp",
"MediaMetrics.cpp",
],
diff --git a/media/libmediametrics/IMediaAnalyticsService.cpp b/media/libmediametrics/IMediaMetricsService.cpp
similarity index 80%
rename from media/libmediametrics/IMediaAnalyticsService.cpp
rename to media/libmediametrics/IMediaMetricsService.cpp
index 534aece..b5675e6 100644
--- a/media/libmediametrics/IMediaAnalyticsService.cpp
+++ b/media/libmediametrics/IMediaMetricsService.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "MediaAnalytics"
+#define LOG_TAG "MediaMetrics"
#include <stdint.h>
#include <inttypes.h>
@@ -29,8 +29,8 @@
#include <utils/Log.h>
#include <utils/String8.h>
-#include <media/MediaAnalyticsItem.h>
-#include <media/IMediaAnalyticsService.h>
+#include <media/MediaMetricsItem.h>
+#include <media/IMediaMetricsService.h>
namespace android {
@@ -41,15 +41,15 @@
SUBMIT_BUFFER,
};
-class BpMediaAnalyticsService: public BpInterface<IMediaAnalyticsService>
+class BpMediaMetricsService: public BpInterface<IMediaMetricsService>
{
public:
- explicit BpMediaAnalyticsService(const sp<IBinder>& impl)
- : BpInterface<IMediaAnalyticsService>(impl)
+ explicit BpMediaMetricsService(const sp<IBinder>& impl)
+ : BpInterface<IMediaMetricsService>(impl)
{
}
- status_t submit(MediaAnalyticsItem *item) override
+ status_t submit(mediametrics::Item *item) override
{
if (item == nullptr) {
return BAD_VALUE;
@@ -57,7 +57,7 @@
ALOGV("%s: (ONEWAY) item=%s", __func__, item->toString().c_str());
Parcel data;
- data.writeInterfaceToken(IMediaAnalyticsService::getInterfaceDescriptor());
+ data.writeInterfaceToken(IMediaMetricsService::getInterfaceDescriptor());
status_t status = item->writeToParcel(&data);
if (status != NO_ERROR) { // assume failure logged in item
@@ -79,7 +79,7 @@
ALOGV("%s: (ONEWAY) length:%zu", __func__, length);
Parcel data;
- data.writeInterfaceToken(IMediaAnalyticsService::getInterfaceDescriptor());
+ data.writeInterfaceToken(IMediaMetricsService::getInterfaceDescriptor());
status_t status = data.writeInt32(length)
?: data.write((uint8_t*)buffer, length);
@@ -95,18 +95,18 @@
}
};
-IMPLEMENT_META_INTERFACE(MediaAnalyticsService, "android.media.IMediaAnalyticsService");
+IMPLEMENT_META_INTERFACE(MediaMetricsService, "android.media.IMediaMetricsService");
// ----------------------------------------------------------------------
-status_t BnMediaAnalyticsService::onTransact(
+status_t BnMediaMetricsService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
switch (code) {
case SUBMIT_ITEM: {
- CHECK_INTERFACE(IMediaAnalyticsService, data, reply);
+ CHECK_INTERFACE(IMediaMetricsService, data, reply);
- MediaAnalyticsItem * const item = MediaAnalyticsItem::create();
+ mediametrics::Item * const item = mediametrics::Item::create();
status_t status = item->readFromParcel(data);
if (status != NO_ERROR) { // assume failure logged in item
return status;
@@ -116,7 +116,7 @@
return NO_ERROR;
}
case SUBMIT_BUFFER: {
- CHECK_INTERFACE(IMediaAnalyticsService, data, reply);
+ CHECK_INTERFACE(IMediaMetricsService, data, reply);
int32_t length;
status_t status = data.readInt32(&length);
if (status != NO_ERROR || length <= 0) {
diff --git a/media/libmediametrics/MediaMetrics.cpp b/media/libmediametrics/MediaMetrics.cpp
index cf268e0..4aceac5 100644
--- a/media/libmediametrics/MediaMetrics.cpp
+++ b/media/libmediametrics/MediaMetrics.cpp
@@ -21,7 +21,7 @@
#include <string.h>
#include <sys/types.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/MediaMetrics.h>
//
@@ -34,25 +34,25 @@
// manage the overall record
mediametrics_handle_t mediametrics_create(mediametricskey_t key) {
- android::MediaAnalyticsItem *item = android::MediaAnalyticsItem::create(key);
+ android::mediametrics::Item *item = android::mediametrics::Item::create(key);
return (mediametrics_handle_t) item;
}
void mediametrics_delete(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return;
delete item;
}
mediametricskey_t mediametrics_getKey(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return NULL;
return strdup(item->getKey().c_str());
}
// nuplayer, et al use it when acting as proxies
void mediametrics_setUid(mediametrics_handle_t handle, uid_t uid) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setUid(uid);
}
@@ -61,31 +61,31 @@
void mediametrics_setInt32(mediametrics_handle_t handle, attr_t attr,
int32_t value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setInt32(attr, value);
}
void mediametrics_setInt64(mediametrics_handle_t handle, attr_t attr,
int64_t value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setInt64(attr, value);
}
void mediametrics_setDouble(mediametrics_handle_t handle, attr_t attr,
double value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setDouble(attr, value);
}
void mediametrics_setRate(mediametrics_handle_t handle, attr_t attr,
int64_t count, int64_t duration) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setRate(attr, count, duration);
}
void mediametrics_setCString(mediametrics_handle_t handle, attr_t attr,
const char *value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->setCString(attr, value);
}
@@ -94,25 +94,25 @@
void mediametrics_addInt32(mediametrics_handle_t handle, attr_t attr,
int32_t value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->addInt32(attr, value);
}
void mediametrics_addInt64(mediametrics_handle_t handle, attr_t attr,
int64_t value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->addInt64(attr, value);
}
void mediametrics_addDouble(mediametrics_handle_t handle, attr_t attr,
double value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->addDouble(attr, value);
}
void mediametrics_addRate(mediametrics_handle_t handle, attr_t attr,
int64_t count, int64_t duration) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item != NULL) item->addRate(attr, count, duration);
}
@@ -123,28 +123,28 @@
bool mediametrics_getInt32(mediametrics_handle_t handle, attr_t attr,
int32_t * value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->getInt32(attr, value);
}
bool mediametrics_getInt64(mediametrics_handle_t handle, attr_t attr,
int64_t * value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->getInt64(attr, value);
}
bool mediametrics_getDouble(mediametrics_handle_t handle, attr_t attr,
double *value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->getDouble(attr, value);
}
bool mediametrics_getRate(mediametrics_handle_t handle, attr_t attr,
int64_t * count, int64_t * duration, double *rate) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->getRate(attr, count, duration, rate);
}
@@ -152,7 +152,7 @@
// NB: caller owns the string that comes back, is responsible for freeing it
bool mediametrics_getCString(mediametrics_handle_t handle, attr_t attr,
char **value) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->getCString(attr, value);
@@ -164,36 +164,36 @@
}
bool mediametrics_selfRecord(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->selfrecord();
}
mediametrics_handle_t mediametrics_dup(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
- if (item == NULL) return android::MediaAnalyticsItem::convert(item);
- return android::MediaAnalyticsItem::convert(item->dup());
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
+ if (item == NULL) return android::mediametrics::Item::convert(item);
+ return android::mediametrics::Item::convert(item->dup());
}
const char *mediametrics_readable(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return "";
return item->toCString();
}
int32_t mediametrics_count(mediametrics_handle_t handle) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return 0;
return item->count();
}
bool mediametrics_isEnabled() {
// static, so doesn't need an instance
- return android::MediaAnalyticsItem::isEnabled();
+ return android::mediametrics::Item::isEnabled();
}
bool mediametrics_getAttributes(mediametrics_handle_t handle, char **buffer, size_t *length) {
- android::MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+ android::mediametrics::Item *item = (android::mediametrics::Item *) handle;
if (item == NULL) return false;
return item->writeToByteString(buffer, length) == android::NO_ERROR;
diff --git a/media/libmediametrics/MediaAnalyticsItem.cpp b/media/libmediametrics/MediaMetricsItem.cpp
similarity index 87%
rename from media/libmediametrics/MediaAnalyticsItem.cpp
rename to media/libmediametrics/MediaMetricsItem.cpp
index 8025e49..98158d2 100644
--- a/media/libmediametrics/MediaAnalyticsItem.cpp
+++ b/media/libmediametrics/MediaMetricsItem.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#define LOG_TAG "MediaAnalyticsItem"
+#define LOG_TAG "mediametrics::Item"
#include <inttypes.h>
#include <stdlib.h>
@@ -31,15 +31,15 @@
#include <utils/threads.h>
#include <binder/IServiceManager.h>
-#include <media/IMediaAnalyticsService.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/IMediaMetricsService.h>
+#include <media/MediaMetricsItem.h>
#include <private/android_filesystem_config.h>
// Max per-property string size before truncation in toString().
// Do not make too large, as this is used for dumpsys purposes.
static constexpr size_t kMaxPropertyStringSize = 4096;
-namespace android {
+namespace android::mediametrics {
#define DEBUG_SERVICEACCESS 0
#define DEBUG_API 0
@@ -49,24 +49,24 @@
// the service is off.
#define SVC_TRIES 2
-MediaAnalyticsItem* MediaAnalyticsItem::convert(mediametrics_handle_t handle) {
- MediaAnalyticsItem *item = (android::MediaAnalyticsItem *) handle;
+mediametrics::Item* mediametrics::Item::convert(mediametrics_handle_t handle) {
+ mediametrics::Item *item = (android::mediametrics::Item *) handle;
return item;
}
-mediametrics_handle_t MediaAnalyticsItem::convert(MediaAnalyticsItem *item ) {
+mediametrics_handle_t mediametrics::Item::convert(mediametrics::Item *item ) {
mediametrics_handle_t handle = (mediametrics_handle_t) item;
return handle;
}
-MediaAnalyticsItem::~MediaAnalyticsItem() {
+mediametrics::Item::~Item() {
if (DEBUG_ALLOCATIONS) {
- ALOGD("Destroy MediaAnalyticsItem @ %p", this);
+ ALOGD("Destroy mediametrics::Item @ %p", this);
}
clear();
}
-void MediaAnalyticsItem::clear() {
+void mediametrics::Item::clear() {
// clean allocated storage from key
mKey.clear();
@@ -88,8 +88,8 @@
}
// make a deep copy of myself
-MediaAnalyticsItem *MediaAnalyticsItem::dup() {
- MediaAnalyticsItem *dst = new MediaAnalyticsItem(this->mKey);
+mediametrics::Item *mediametrics::Item::dup() {
+ mediametrics::Item *dst = new mediametrics::Item(this->mKey);
if (dst != NULL) {
// key as part of constructor
@@ -110,50 +110,50 @@
return dst;
}
-MediaAnalyticsItem &MediaAnalyticsItem::setTimestamp(nsecs_t ts) {
+mediametrics::Item &mediametrics::Item::setTimestamp(nsecs_t ts) {
mTimestamp = ts;
return *this;
}
-nsecs_t MediaAnalyticsItem::getTimestamp() const {
+nsecs_t mediametrics::Item::getTimestamp() const {
return mTimestamp;
}
-MediaAnalyticsItem &MediaAnalyticsItem::setPid(pid_t pid) {
+mediametrics::Item &mediametrics::Item::setPid(pid_t pid) {
mPid = pid;
return *this;
}
-pid_t MediaAnalyticsItem::getPid() const {
+pid_t mediametrics::Item::getPid() const {
return mPid;
}
-MediaAnalyticsItem &MediaAnalyticsItem::setUid(uid_t uid) {
+mediametrics::Item &mediametrics::Item::setUid(uid_t uid) {
mUid = uid;
return *this;
}
-uid_t MediaAnalyticsItem::getUid() const {
+uid_t mediametrics::Item::getUid() const {
return mUid;
}
-MediaAnalyticsItem &MediaAnalyticsItem::setPkgName(const std::string &pkgName) {
+mediametrics::Item &mediametrics::Item::setPkgName(const std::string &pkgName) {
mPkgName = pkgName;
return *this;
}
-MediaAnalyticsItem &MediaAnalyticsItem::setPkgVersionCode(int64_t pkgVersionCode) {
+mediametrics::Item &mediametrics::Item::setPkgVersionCode(int64_t pkgVersionCode) {
mPkgVersionCode = pkgVersionCode;
return *this;
}
-int64_t MediaAnalyticsItem::getPkgVersionCode() const {
+int64_t mediametrics::Item::getPkgVersionCode() const {
return mPkgVersionCode;
}
// find the proper entry in the list
-size_t MediaAnalyticsItem::findPropIndex(const char *name) const
+size_t mediametrics::Item::findPropIndex(const char *name) const
{
size_t i = 0;
for (; i < mPropCount; i++) {
@@ -162,7 +162,7 @@
return i;
}
-MediaAnalyticsItem::Prop *MediaAnalyticsItem::findProp(const char *name) const {
+mediametrics::Item::Prop *mediametrics::Item::findProp(const char *name) const {
const size_t i = findPropIndex(name);
if (i < mPropCount) {
return &mProps[i];
@@ -172,7 +172,7 @@
// consider this "find-or-allocate".
// caller validates type and uses clearPropValue() accordingly
-MediaAnalyticsItem::Prop *MediaAnalyticsItem::allocateProp(const char *name) {
+mediametrics::Item::Prop *mediametrics::Item::allocateProp(const char *name) {
const size_t i = findPropIndex(name);
if (i < mPropCount) {
return &mProps[i]; // already have it, return
@@ -184,7 +184,7 @@
return prop;
}
-MediaAnalyticsItem::Prop *MediaAnalyticsItem::allocateProp() {
+mediametrics::Item::Prop *mediametrics::Item::allocateProp() {
if (mPropCount == mPropSize && growProps() == false) {
ALOGE("%s: failed allocation for new properties", __func__);
return nullptr;
@@ -193,7 +193,7 @@
}
// used within the summarizers; return whether property existed
-bool MediaAnalyticsItem::removeProp(const char *name) {
+bool mediametrics::Item::removeProp(const char *name) {
const size_t i = findPropIndex(name);
if (i < mPropCount) {
mProps[i].clear();
@@ -209,7 +209,7 @@
// remove indicated keys and their values
// return value is # keys removed
-size_t MediaAnalyticsItem::filter(size_t n, const char *attrs[]) {
+size_t mediametrics::Item::filter(size_t n, const char *attrs[]) {
size_t zapped = 0;
for (size_t i = 0; i < n; ++i) {
const char *name = attrs[i];
@@ -235,7 +235,7 @@
// remove any keys NOT in the provided list
// return value is # keys removed
-size_t MediaAnalyticsItem::filterNot(size_t n, const char *attrs[]) {
+size_t mediametrics::Item::filterNot(size_t n, const char *attrs[]) {
std::set<std::string> check(attrs, attrs + n);
size_t zapped = 0;
for (size_t j = 0; j < mPropCount;) {
@@ -260,7 +260,7 @@
return zapped;
}
-bool MediaAnalyticsItem::growProps(int increment)
+bool mediametrics::Item::growProps(int increment)
{
if (increment <= 0) {
increment = kGrowProps;
@@ -276,7 +276,7 @@
mPropSize = nsize;
return true;
} else {
- ALOGW("MediaAnalyticsItem::growProps fails");
+ ALOGW("mediametrics::Item::growProps fails");
return false;
}
}
@@ -284,7 +284,7 @@
// Parcel / serialize things for binder calls
//
-status_t MediaAnalyticsItem::readFromParcel(const Parcel& data) {
+status_t mediametrics::Item::readFromParcel(const Parcel& data) {
int32_t version;
status_t status = data.readInt32(&version);
if (status != NO_ERROR) return status;
@@ -298,7 +298,7 @@
}
}
-status_t MediaAnalyticsItem::readFromParcel0(const Parcel& data) {
+status_t mediametrics::Item::readFromParcel0(const Parcel& data) {
const char *s = data.readCString();
mKey = s == nullptr ? "" : s;
int32_t pid, uid;
@@ -323,7 +323,7 @@
return NO_ERROR;
}
-status_t MediaAnalyticsItem::writeToParcel(Parcel *data) const {
+status_t mediametrics::Item::writeToParcel(Parcel *data) const {
if (data == nullptr) return BAD_VALUE;
const int32_t version = 0;
@@ -339,7 +339,7 @@
}
}
-status_t MediaAnalyticsItem::writeToParcel0(Parcel *data) const {
+status_t mediametrics::Item::writeToParcel0(Parcel *data) const {
status_t status =
data->writeCString(mKey.c_str())
?: data->writeInt32(mPid)
@@ -357,20 +357,20 @@
return NO_ERROR;
}
-const char *MediaAnalyticsItem::toCString() {
+const char *mediametrics::Item::toCString() {
return toCString(PROTO_LAST);
}
-const char * MediaAnalyticsItem::toCString(int version) {
+const char * mediametrics::Item::toCString(int version) {
std::string val = toString(version);
return strdup(val.c_str());
}
-std::string MediaAnalyticsItem::toString() const {
+std::string mediametrics::Item::toString() const {
return toString(PROTO_LAST);
}
-std::string MediaAnalyticsItem::toString(int version) const {
+std::string mediametrics::Item::toString(int version) const {
std::string result;
char buffer[kMaxPropertyStringSize];
@@ -388,9 +388,9 @@
// for the lazy, we offer methods that finds the service and
// calls the appropriate daemon
-bool MediaAnalyticsItem::selfrecord() {
+bool mediametrics::Item::selfrecord() {
ALOGD_IF(DEBUG_API, "%s: delivering %s", __func__, this->toString().c_str());
- sp<IMediaAnalyticsService> svc = getInstance();
+ sp<IMediaMetricsService> svc = getInstance();
if (svc != NULL) {
status_t status = svc->submit(this);
if (status != NO_ERROR) {
@@ -403,7 +403,6 @@
}
}
-namespace mediametrics {
//static
bool BaseItem::isEnabled() {
// completely skip logging from certain UIDs. We do this here
@@ -420,12 +419,12 @@
return false;
}
- int enabled = property_get_int32(MediaAnalyticsItem::EnabledProperty, -1);
+ int enabled = property_get_int32(Item::EnabledProperty, -1);
if (enabled == -1) {
- enabled = property_get_int32(MediaAnalyticsItem::EnabledPropertyPersist, -1);
+ enabled = property_get_int32(Item::EnabledPropertyPersist, -1);
}
if (enabled == -1) {
- enabled = MediaAnalyticsItem::EnabledProperty_default;
+ enabled = Item::EnabledProperty_default;
}
return enabled > 0;
}
@@ -440,7 +439,7 @@
static sp<MediaMetricsDeathNotifier> sNotifier;
// static
-sp<IMediaAnalyticsService> BaseItem::sAnalyticsService;
+sp<IMediaMetricsService> BaseItem::sMediaMetricsService;
static std::mutex sServiceMutex;
static int sRemainingBindAttempts = SVC_TRIES;
@@ -448,20 +447,20 @@
void BaseItem::dropInstance() {
std::lock_guard _l(sServiceMutex);
sRemainingBindAttempts = SVC_TRIES;
- sAnalyticsService = nullptr;
+ sMediaMetricsService = nullptr;
}
// static
bool BaseItem::submitBuffer(const char *buffer, size_t size) {
/*
- MediaAnalyticsItem item;
+ mediametrics::Item item;
status_t status = item.readFromByteString(buffer, size);
ALOGD("%s: status:%d, size:%zu, item:%s", __func__, status, size, item.toString().c_str());
return item.selfrecord();
*/
ALOGD_IF(DEBUG_API, "%s: delivering %zu bytes", __func__, size);
- sp<IMediaAnalyticsService> svc = getInstance();
+ sp<IMediaMetricsService> svc = getInstance();
if (svc != nullptr) {
const status_t status = svc->submitBuffer(buffer, size);
if (status != NO_ERROR) {
@@ -474,7 +473,7 @@
}
//static
-sp<IMediaAnalyticsService> BaseItem::getInstance() {
+sp<IMediaMetricsService> BaseItem::getInstance() {
static const char *servicename = "media.metrics";
static const bool enabled = isEnabled(); // singleton initialized
@@ -486,13 +485,13 @@
// think of remainingBindAttempts as telling us whether service == nullptr because
// (1) we haven't tried to initialize it yet
// (2) we've tried to initialize it, but failed.
- if (sAnalyticsService == nullptr && sRemainingBindAttempts > 0) {
+ if (sMediaMetricsService == nullptr && sRemainingBindAttempts > 0) {
const char *badness = "";
sp<IServiceManager> sm = defaultServiceManager();
if (sm != nullptr) {
sp<IBinder> binder = sm->getService(String16(servicename));
if (binder != nullptr) {
- sAnalyticsService = interface_cast<IMediaAnalyticsService>(binder);
+ sMediaMetricsService = interface_cast<IMediaMetricsService>(binder);
sNotifier = new MediaMetricsDeathNotifier();
binder->linkToDeath(sNotifier);
} else {
@@ -501,7 +500,7 @@
} else {
badness = "No Service Manager access";
}
- if (sAnalyticsService == nullptr) {
+ if (sMediaMetricsService == nullptr) {
if (sRemainingBindAttempts > 0) {
sRemainingBindAttempts--;
}
@@ -509,14 +508,13 @@
__func__, servicename, badness);
}
}
- return sAnalyticsService;
+ return sMediaMetricsService;
}
-} // namespace mediametrics
// merge the info from 'incoming' into this record.
// we finish with a union of this+incoming and special handling for collisions
-bool MediaAnalyticsItem::merge(MediaAnalyticsItem *incoming) {
+bool mediametrics::Item::merge(mediametrics::Item *incoming) {
// if I don't have key or session id, take them from incoming
// 'this' should never be missing both of them...
@@ -623,7 +621,7 @@
} // namespace
-status_t MediaAnalyticsItem::writeToByteString(char **pbuffer, size_t *plength) const
+status_t mediametrics::Item::writeToByteString(char **pbuffer, size_t *plength) const
{
if (pbuffer == nullptr || plength == nullptr)
return BAD_VALUE;
@@ -701,7 +699,7 @@
return NO_ERROR;
}
-status_t MediaAnalyticsItem::readFromByteString(const char *bufferptr, size_t length)
+status_t mediametrics::Item::readFromByteString(const char *bufferptr, size_t length)
{
if (bufferptr == nullptr) return BAD_VALUE;
@@ -761,7 +759,7 @@
return NO_ERROR;
}
-status_t MediaAnalyticsItem::Prop::writeToParcel(Parcel *data) const
+status_t mediametrics::Item::Prop::writeToParcel(Parcel *data) const
{
switch (mType) {
case kTypeInt32:
@@ -791,7 +789,7 @@
}
}
-status_t MediaAnalyticsItem::Prop::readFromParcel(const Parcel& data)
+status_t mediametrics::Item::Prop::readFromParcel(const Parcel& data)
{
const char *key = data.readCString();
if (key == nullptr) return BAD_VALUE;
@@ -834,23 +832,23 @@
return status;
}
-void MediaAnalyticsItem::Prop::toString(char *buffer, size_t length) const
+void mediametrics::Item::Prop::toString(char *buffer, size_t length) const
{
switch (mType) {
case kTypeInt32:
snprintf(buffer, length, "%s=%d:", mName, u.int32Value);
break;
- case MediaAnalyticsItem::kTypeInt64:
+ case mediametrics::Item::kTypeInt64:
snprintf(buffer, length, "%s=%lld:", mName, (long long)u.int64Value);
break;
- case MediaAnalyticsItem::kTypeDouble:
+ case mediametrics::Item::kTypeDouble:
snprintf(buffer, length, "%s=%e:", mName, u.doubleValue);
break;
- case MediaAnalyticsItem::kTypeRate:
+ case mediametrics::Item::kTypeRate:
snprintf(buffer, length, "%s=%lld/%lld:",
mName, (long long)u.rate.first, (long long)u.rate.second);
break;
- case MediaAnalyticsItem::kTypeCString:
+ case mediametrics::Item::kTypeCString:
// TODO sanitize string for ':' '='
snprintf(buffer, length, "%s=%s:", mName, u.CStringValue);
break;
@@ -861,7 +859,7 @@
}
}
-size_t MediaAnalyticsItem::Prop::getByteStringSize() const
+size_t mediametrics::Item::Prop::getByteStringSize() const
{
const size_t header =
sizeof(uint16_t) // length
@@ -869,19 +867,19 @@
+ strlen(mName) + 1; // mName + 0 termination
size_t payload = 0;
switch (mType) {
- case MediaAnalyticsItem::kTypeInt32:
+ case mediametrics::Item::kTypeInt32:
payload = sizeof(u.int32Value);
break;
- case MediaAnalyticsItem::kTypeInt64:
+ case mediametrics::Item::kTypeInt64:
payload = sizeof(u.int64Value);
break;
- case MediaAnalyticsItem::kTypeDouble:
+ case mediametrics::Item::kTypeDouble:
payload = sizeof(u.doubleValue);
break;
- case MediaAnalyticsItem::kTypeRate:
+ case mediametrics::Item::kTypeRate:
payload = sizeof(u.rate.first) + sizeof(u.rate.second);
break;
- case MediaAnalyticsItem::kTypeCString:
+ case mediametrics::Item::kTypeCString:
payload = strlen(u.CStringValue) + 1;
break;
default:
@@ -892,7 +890,6 @@
return header + payload;
}
-namespace mediametrics {
// TODO: fold into a template later.
status_t BaseItem::writeToByteString(
@@ -968,9 +965,8 @@
?: insert(name, bufferpptr, bufferptrmax);
}
-} // namespace mediametrics
-status_t MediaAnalyticsItem::Prop::writeToByteString(
+status_t mediametrics::Item::Prop::writeToByteString(
char **bufferpptr, char *bufferptrmax) const
{
switch (mType) {
@@ -993,7 +989,7 @@
}
}
-status_t MediaAnalyticsItem::Prop::readFromByteString(
+status_t mediametrics::Item::Prop::readFromByteString(
const char **bufferpptr, const char *bufferptrmax)
{
uint16_t len;
@@ -1036,4 +1032,4 @@
}
}
-} // namespace android
+} // namespace android::mediametrics
diff --git a/media/libmediametrics/include/IMediaAnalyticsService.h b/media/libmediametrics/include/IMediaMetricsService.h
similarity index 83%
rename from media/libmediametrics/include/IMediaAnalyticsService.h
rename to media/libmediametrics/include/IMediaMetricsService.h
index 30c63e7..d6871ec 100644
--- a/media/libmediametrics/include/IMediaAnalyticsService.h
+++ b/media/libmediametrics/include/IMediaMetricsService.h
@@ -29,15 +29,14 @@
#include <binder/IServiceManager.h>
-#include <media/MediaAnalyticsItem.h>
-// nope...#include <media/MediaAnalytics.h>
+#include <media/MediaMetricsItem.h>
namespace android {
-class IMediaAnalyticsService: public IInterface
+class IMediaMetricsService: public IInterface
{
public:
- DECLARE_META_INTERFACE(MediaAnalyticsService);
+ DECLARE_META_INTERFACE(MediaMetricsService);
/**
* Submits the indicated record to the mediaanalytics service, where
@@ -48,14 +47,14 @@
* \return status which is negative if an error is detected (some errors
may be silent and return 0 - success).
*/
- virtual status_t submit(MediaAnalyticsItem *item) = 0;
+ virtual status_t submit(mediametrics::Item *item) = 0;
virtual status_t submitBuffer(const char *buffer, size_t length) = 0;
};
// ----------------------------------------------------------------------------
-class BnMediaAnalyticsService: public BnInterface<IMediaAnalyticsService>
+class BnMediaMetricsService: public BnInterface<IMediaMetricsService>
{
public:
status_t onTransact(uint32_t code,
@@ -66,7 +65,7 @@
protected:
// Internal call where release is true if the service is to delete the item.
virtual status_t submitInternal(
- MediaAnalyticsItem *item, bool release) = 0;
+ mediametrics::Item *item, bool release) = 0;
};
}; // namespace android
diff --git a/media/libmediametrics/include/MediaAnalyticsItem.h b/media/libmediametrics/include/MediaMetricsItem.h
similarity index 90%
rename from media/libmediametrics/include/MediaAnalyticsItem.h
rename to media/libmediametrics/include/MediaMetricsItem.h
index bff7c9b..5f33650 100644
--- a/media/libmediametrics/include/MediaAnalyticsItem.h
+++ b/media/libmediametrics/include/MediaMetricsItem.h
@@ -32,7 +32,7 @@
namespace android {
-class IMediaAnalyticsService;
+class IMediaMetricsService;
class Parcel;
/*
@@ -115,8 +115,8 @@
static const int EnabledProperty_default = 1;
// let's reuse a binder connection
- static sp<IMediaAnalyticsService> sAnalyticsService;
- static sp<IMediaAnalyticsService> getInstance();
+ static sp<IMediaMetricsService> sMediaMetricsService;
+ static sp<IMediaMetricsService> getInstance();
static void dropInstance();
static bool submitBuffer(const char *buffer, size_t len);
@@ -329,26 +329,26 @@
};
/**
- * MediaMetrics Item is a stack allocated media analytics item used for
+ * MediaMetrics LogItem is a stack allocated media analytics item used for
* fast logging. It falls over to a malloc if needed.
*
* This is templated with a buffer size to allocate on the stack.
*/
template <size_t N = 4096>
-class Item : public BufferedItem {
+class LogItem : public BufferedItem {
public:
- explicit Item(const std::string key) : Item(key.c_str()) { }
+ explicit LogItem(const std::string key) : LogItem(key.c_str()) { }
// Since this class will not be defined before the base class, we initialize variables
// in our own order.
- explicit Item(const char *key) {
+ explicit LogItem(const char *key) {
mBegin = mBuffer;
mEnd = mBuffer + N;
mBaseRealloc = &mReallocPtr;
init(key);
}
- ~Item() override {
+ ~LogItem() override {
if (mReallocPtr != nullptr) { // do the check before calling free to avoid overhead.
free(mReallocPtr);
}
@@ -359,18 +359,17 @@
char mBuffer[N];
};
-} // mediametrics
/**
- * Media Metrics MediaAnalyticsItem
+ * Media Metrics Item
*
* A mutable item representing an event or record that will be
* logged with the Media Metrics service. For client logging, one should
* use the mediametrics::Item.
*
- * The MediaAnalyticsItem is designed for the service as it has getters.
+ * The Item is designed for the service as it has getters.
*/
-class MediaAnalyticsItem : public mediametrics::BaseItem {
+class Item : public mediametrics::BaseItem {
friend class MediaMetricsJNI; // TODO: remove this access
public:
@@ -397,14 +396,14 @@
// T must be convertible to mKey
template <typename T>
- explicit MediaAnalyticsItem(T key)
+ explicit Item(T key)
: mKey(key) { }
- MediaAnalyticsItem() = default;
+ Item() = default;
- MediaAnalyticsItem(const MediaAnalyticsItem&) = delete;
- MediaAnalyticsItem &operator=(const MediaAnalyticsItem&) = delete;
+ Item(const Item&) = delete;
+ Item &operator=(const Item&) = delete;
- bool operator==(const MediaAnalyticsItem& other) const {
+ bool operator==(const Item& other) const {
if (mPropCount != other.mPropCount
|| mPid != other.mPid
|| mUid != other.mUid
@@ -418,29 +417,29 @@
}
return true;
}
- bool operator!=(const MediaAnalyticsItem& other) const {
+ bool operator!=(const Item& other) const {
return !(*this == other);
}
template <typename T>
- static MediaAnalyticsItem* create(T key) {
- return new MediaAnalyticsItem(key);
+ static Item* create(T key) {
+ return new Item(key);
}
- static MediaAnalyticsItem* create() {
- return new MediaAnalyticsItem();
+ static Item* create() {
+ return new Item();
}
- static MediaAnalyticsItem* convert(mediametrics_handle_t);
- static mediametrics_handle_t convert(MediaAnalyticsItem *);
+ static Item* convert(mediametrics_handle_t);
+ static mediametrics_handle_t convert(Item *);
// access functions for the class
- ~MediaAnalyticsItem();
+ ~Item();
// reset all contents, discarding any extra data
void clear();
- MediaAnalyticsItem *dup();
+ Item *dup();
- MediaAnalyticsItem &setKey(const char *key) {
+ Item &setKey(const char *key) {
mKey = key;
return *this;
}
@@ -450,46 +449,46 @@
size_t count() const { return mPropCount; }
template<typename S, typename T>
- MediaAnalyticsItem &set(S key, T value) {
+ Item &set(S key, T value) {
allocateProp(key)->set(value);
return *this;
}
// set values appropriately
- MediaAnalyticsItem &setInt32(const char *key, int32_t value) {
+ Item &setInt32(const char *key, int32_t value) {
return set(key, value);
}
- MediaAnalyticsItem &setInt64(const char *key, int64_t value) {
+ Item &setInt64(const char *key, int64_t value) {
return set(key, value);
}
- MediaAnalyticsItem &setDouble(const char *key, double value) {
+ Item &setDouble(const char *key, double value) {
return set(key, value);
}
- MediaAnalyticsItem &setRate(const char *key, int64_t count, int64_t duration) {
+ Item &setRate(const char *key, int64_t count, int64_t duration) {
return set(key, std::make_pair(count, duration));
}
- MediaAnalyticsItem &setCString(const char *key, const char *value) {
+ Item &setCString(const char *key, const char *value) {
return set(key, value);
}
// fused get/add/set; if attr wasn't there, it's a simple set.
// type-mismatch counts as "wasn't there".
template<typename S, typename T>
- MediaAnalyticsItem &add(S key, T value) {
+ Item &add(S key, T value) {
allocateProp(key)->add(value);
return *this;
}
- MediaAnalyticsItem &addInt32(const char *key, int32_t value) {
+ Item &addInt32(const char *key, int32_t value) {
return add(key, value);
}
- MediaAnalyticsItem &addInt64(const char *key, int64_t value) {
+ Item &addInt64(const char *key, int64_t value) {
return add(key, value);
}
- MediaAnalyticsItem &addDouble(const char *key, double value) {
+ Item &addDouble(const char *key, double value) {
return add(key, value);
}
- MediaAnalyticsItem &addRate(const char *key, int64_t count, int64_t duration) {
+ Item &addRate(const char *key, int64_t count, int64_t duration) {
return add(key, std::make_pair(count, duration));
}
@@ -555,19 +554,19 @@
// timestamp, pid, and uid only used on server side
// timestamp is in 'nanoseconds, unix time'
- MediaAnalyticsItem &setTimestamp(nsecs_t);
+ Item &setTimestamp(nsecs_t);
nsecs_t getTimestamp() const;
- MediaAnalyticsItem &setPid(pid_t);
+ Item &setPid(pid_t);
pid_t getPid() const;
- MediaAnalyticsItem &setUid(uid_t);
+ Item &setUid(uid_t);
uid_t getUid() const;
- MediaAnalyticsItem &setPkgName(const std::string &pkgName);
+ Item &setPkgName(const std::string &pkgName);
std::string getPkgName() const { return mPkgName; }
- MediaAnalyticsItem &setPkgVersionCode(int64_t);
+ Item &setPkgVersionCode(int64_t);
int64_t getPkgVersionCode() const;
// our serialization code for binder calls
@@ -589,7 +588,7 @@
// with rules for first/last/add, etc
// XXX: document semantics and how they are indicated
// caller continues to own 'incoming'
- bool merge(MediaAnalyticsItem *incoming);
+ bool merge(Item *incoming);
private:
// handle Parcel version 0
@@ -712,19 +711,19 @@
template <typename T> void visit(T f) const {
switch (mType) {
- case MediaAnalyticsItem::kTypeInt32:
+ case Item::kTypeInt32:
f(u.int32Value);
return;
- case MediaAnalyticsItem::kTypeInt64:
+ case Item::kTypeInt64:
f(u.int64Value);
return;
- case MediaAnalyticsItem::kTypeDouble:
+ case Item::kTypeDouble:
f(u.doubleValue);
return;
- case MediaAnalyticsItem::kTypeRate:
+ case Item::kTypeRate:
f(u.rate);
return;
- case MediaAnalyticsItem::kTypeCString:
+ case Item::kTypeCString:
f(u.CStringValue);
return;
default:
@@ -885,7 +884,7 @@
class iterator {
public:
- iterator(size_t pos, const MediaAnalyticsItem &_item)
+ iterator(size_t pos, const Item &_item)
: i(std::min(pos, _item.count()))
, item(_item) { }
iterator &operator++() {
@@ -901,7 +900,7 @@
private:
size_t i;
- const MediaAnalyticsItem &item;
+ const Item &item;
};
iterator begin() const {
@@ -938,6 +937,7 @@
nsecs_t mTimestamp = 0;
};
+} // namespace mediametrics
} // namespace android
#endif
diff --git a/media/libmediaplayerservice/StagefrightRecorder.cpp b/media/libmediaplayerservice/StagefrightRecorder.cpp
index d36c6e3..001dccf 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.cpp
+++ b/media/libmediaplayerservice/StagefrightRecorder.cpp
@@ -31,7 +31,7 @@
#include <binder/IServiceManager.h>
#include <media/IMediaPlayerService.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AMessage.h>
@@ -138,7 +138,7 @@
}
// log the current record, provided it has some information worth recording
- // NB: this also reclaims & clears mAnalyticsItem.
+ // NB: this also reclaims & clears mMetricsItem.
flushAndResetMetrics(false);
}
@@ -147,69 +147,69 @@
// we run as part of the media player service; what we really want to
// know is the app which requested the recording.
- mAnalyticsItem->setUid(mClientUid);
+ mMetricsItem->setUid(mClientUid);
// populate the values from the raw fields.
// TBD mOutputFormat = OUTPUT_FORMAT_THREE_GPP;
// TBD mAudioEncoder = AUDIO_ENCODER_AMR_NB;
// TBD mVideoEncoder = VIDEO_ENCODER_DEFAULT;
- mAnalyticsItem->setInt32(kRecorderHeight, mVideoHeight);
- mAnalyticsItem->setInt32(kRecorderWidth, mVideoWidth);
- mAnalyticsItem->setInt32(kRecorderFrameRate, mFrameRate);
- mAnalyticsItem->setInt32(kRecorderVideoBitrate, mVideoBitRate);
- mAnalyticsItem->setInt32(kRecorderAudioSampleRate, mSampleRate);
- mAnalyticsItem->setInt32(kRecorderAudioChannels, mAudioChannels);
- mAnalyticsItem->setInt32(kRecorderAudioBitrate, mAudioBitRate);
+ mMetricsItem->setInt32(kRecorderHeight, mVideoHeight);
+ mMetricsItem->setInt32(kRecorderWidth, mVideoWidth);
+ mMetricsItem->setInt32(kRecorderFrameRate, mFrameRate);
+ mMetricsItem->setInt32(kRecorderVideoBitrate, mVideoBitRate);
+ mMetricsItem->setInt32(kRecorderAudioSampleRate, mSampleRate);
+ mMetricsItem->setInt32(kRecorderAudioChannels, mAudioChannels);
+ mMetricsItem->setInt32(kRecorderAudioBitrate, mAudioBitRate);
// TBD mInterleaveDurationUs = 0;
- mAnalyticsItem->setInt32(kRecorderVideoIframeInterval, mIFramesIntervalSec);
+ mMetricsItem->setInt32(kRecorderVideoIframeInterval, mIFramesIntervalSec);
// TBD mAudioSourceNode = 0;
// TBD mUse64BitFileOffset = false;
if (mMovieTimeScale != -1)
- mAnalyticsItem->setInt32(kRecorderMovieTimescale, mMovieTimeScale);
+ mMetricsItem->setInt32(kRecorderMovieTimescale, mMovieTimeScale);
if (mAudioTimeScale != -1)
- mAnalyticsItem->setInt32(kRecorderAudioTimescale, mAudioTimeScale);
+ mMetricsItem->setInt32(kRecorderAudioTimescale, mAudioTimeScale);
if (mVideoTimeScale != -1)
- mAnalyticsItem->setInt32(kRecorderVideoTimescale, mVideoTimeScale);
+ mMetricsItem->setInt32(kRecorderVideoTimescale, mVideoTimeScale);
// TBD mCameraId = 0;
// TBD mStartTimeOffsetMs = -1;
- mAnalyticsItem->setInt32(kRecorderVideoProfile, mVideoEncoderProfile);
- mAnalyticsItem->setInt32(kRecorderVideoLevel, mVideoEncoderLevel);
+ mMetricsItem->setInt32(kRecorderVideoProfile, mVideoEncoderProfile);
+ mMetricsItem->setInt32(kRecorderVideoLevel, mVideoEncoderLevel);
// TBD mMaxFileDurationUs = 0;
// TBD mMaxFileSizeBytes = 0;
// TBD mTrackEveryTimeDurationUs = 0;
- mAnalyticsItem->setInt32(kRecorderCaptureFpsEnable, mCaptureFpsEnable);
- mAnalyticsItem->setDouble(kRecorderCaptureFps, mCaptureFps);
+ mMetricsItem->setInt32(kRecorderCaptureFpsEnable, mCaptureFpsEnable);
+ mMetricsItem->setDouble(kRecorderCaptureFps, mCaptureFps);
// TBD mCameraSourceTimeLapse = NULL;
// TBD mMetaDataStoredInVideoBuffers = kMetadataBufferTypeInvalid;
// TBD mEncoderProfiles = MediaProfiles::getInstance();
- mAnalyticsItem->setInt32(kRecorderRotation, mRotationDegrees);
+ mMetricsItem->setInt32(kRecorderRotation, mRotationDegrees);
// PII mLatitudex10000 = -3600000;
// PII mLongitudex10000 = -3600000;
// TBD mTotalBitRate = 0;
// duration information (recorded, paused, # of pauses)
- mAnalyticsItem->setInt64(kRecorderDurationMs, (mDurationRecordedUs+500)/1000 );
+ mMetricsItem->setInt64(kRecorderDurationMs, (mDurationRecordedUs+500)/1000 );
if (mNPauses != 0) {
- mAnalyticsItem->setInt64(kRecorderPaused, (mDurationPausedUs+500)/1000 );
- mAnalyticsItem->setInt32(kRecorderNumPauses, mNPauses);
+ mMetricsItem->setInt64(kRecorderPaused, (mDurationPausedUs+500)/1000 );
+ mMetricsItem->setInt32(kRecorderNumPauses, mNPauses);
}
}
void StagefrightRecorder::flushAndResetMetrics(bool reinitialize) {
ALOGV("flushAndResetMetrics");
// flush anything we have, maybe setup a new record
- if (mAnalyticsDirty && mAnalyticsItem != NULL) {
+ if (mAnalyticsDirty && mMetricsItem != NULL) {
updateMetrics();
- if (mAnalyticsItem->count() > 0) {
- mAnalyticsItem->selfrecord();
+ if (mMetricsItem->count() > 0) {
+ mMetricsItem->selfrecord();
}
- delete mAnalyticsItem;
- mAnalyticsItem = NULL;
+ delete mMetricsItem;
+ mMetricsItem = NULL;
}
mAnalyticsDirty = false;
if (reinitialize) {
- mAnalyticsItem = MediaAnalyticsItem::create(kKeyRecorder);
+ mMetricsItem = mediametrics::Item::create(kKeyRecorder);
}
}
@@ -1184,10 +1184,10 @@
}
// log audio mime type for media metrics
- if (mAnalyticsItem != NULL) {
+ if (mMetricsItem != NULL) {
AString audiomime;
if (format->findString("mime", &audiomime)) {
- mAnalyticsItem->setCString(kRecorderAudioMime, audiomime.c_str());
+ mMetricsItem->setCString(kRecorderAudioMime, audiomime.c_str());
}
}
@@ -1745,10 +1745,10 @@
}
// log video mime type for media metrics
- if (mAnalyticsItem != NULL) {
+ if (mMetricsItem != NULL) {
AString videomime;
if (format->findString("mime", &videomime)) {
- mAnalyticsItem->setCString(kRecorderVideoMime, videomime.c_str());
+ mMetricsItem->setCString(kRecorderVideoMime, videomime.c_str());
}
}
@@ -2266,12 +2266,12 @@
return BAD_VALUE;
}
- if (mAnalyticsItem == NULL) {
+ if (mMetricsItem == NULL) {
return UNKNOWN_ERROR;
}
updateMetrics();
- mAnalyticsItem->writeToParcel(reply);
+ mMetricsItem->writeToParcel(reply);
return OK;
}
diff --git a/media/libmediaplayerservice/StagefrightRecorder.h b/media/libmediaplayerservice/StagefrightRecorder.h
index 9e0f4b7..a725bee 100644
--- a/media/libmediaplayerservice/StagefrightRecorder.h
+++ b/media/libmediaplayerservice/StagefrightRecorder.h
@@ -18,7 +18,7 @@
#define STAGEFRIGHT_RECORDER_H_
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/MediaRecorderBase.h>
#include <camera/CameraParameters.h>
#include <utils/String8.h>
@@ -104,7 +104,7 @@
int mOutputFd;
sp<AudioSource> mAudioSourceNode;
- MediaAnalyticsItem *mAnalyticsItem;
+ mediametrics::Item *mMetricsItem;
bool mAnalyticsDirty;
void flushAndResetMetrics(bool reinitialize);
void updateMetrics();
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index 4d9872a..24afd43 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -35,8 +35,6 @@
#include <media/stagefright/Utils.h>
#include <media/stagefright/FoundationUtils.h>
-#include <media/IMediaAnalyticsService.h>
-
static const int kDumpLockRetries = 50;
static const int kDumpLockSleepUs = 20000;
@@ -87,7 +85,7 @@
mMediaClock(new MediaClock),
mPlayer(new NuPlayer(pid, mMediaClock)),
mPlayerFlags(0),
- mAnalyticsItem(NULL),
+ mMetricsItem(NULL),
mClientUid(-1),
mAtEOS(false),
mLooping(false),
@@ -98,7 +96,7 @@
mMediaClock->init();
// set up an analytics record
- mAnalyticsItem = MediaAnalyticsItem::create(kKeyPlayer);
+ mMetricsItem = mediametrics::Item::create(kKeyPlayer);
mLooper->start(
false, /* runOnCallingThread */
@@ -118,9 +116,9 @@
updateMetrics("destructor");
logMetrics("destructor");
- if (mAnalyticsItem != NULL) {
- delete mAnalyticsItem;
- mAnalyticsItem = NULL;
+ if (mMetricsItem != NULL) {
+ delete mMetricsItem;
+ mMetricsItem = NULL;
}
}
@@ -131,8 +129,8 @@
status_t NuPlayerDriver::setUID(uid_t uid) {
mPlayer->setUID(uid);
mClientUid = uid;
- if (mAnalyticsItem) {
- mAnalyticsItem->setUid(mClientUid);
+ if (mMetricsItem) {
+ mMetricsItem->setUid(mClientUid);
}
return OK;
@@ -560,15 +558,15 @@
if (mime.startsWith("video/")) {
int32_t width, height;
- mAnalyticsItem->setCString(kPlayerVMime, mime.c_str());
+ mMetricsItem->setCString(kPlayerVMime, mime.c_str());
if (!name.empty()) {
- mAnalyticsItem->setCString(kPlayerVCodec, name.c_str());
+ mMetricsItem->setCString(kPlayerVCodec, name.c_str());
}
if (stats->findInt32("width", &width)
&& stats->findInt32("height", &height)) {
- mAnalyticsItem->setInt32(kPlayerWidth, width);
- mAnalyticsItem->setInt32(kPlayerHeight, height);
+ mMetricsItem->setInt32(kPlayerWidth, width);
+ mMetricsItem->setInt32(kPlayerHeight, height);
}
int64_t numFramesTotal = 0;
@@ -576,18 +574,18 @@
stats->findInt64("frames-total", &numFramesTotal);
stats->findInt64("frames-dropped-output", &numFramesDropped);
- mAnalyticsItem->setInt64(kPlayerFrames, numFramesTotal);
- mAnalyticsItem->setInt64(kPlayerFramesDropped, numFramesDropped);
+ mMetricsItem->setInt64(kPlayerFrames, numFramesTotal);
+ mMetricsItem->setInt64(kPlayerFramesDropped, numFramesDropped);
float frameRate = 0;
if (stats->findFloat("frame-rate-total", &frameRate)) {
- mAnalyticsItem->setDouble(kPlayerFrameRate, (double) frameRate);
+ mMetricsItem->setDouble(kPlayerFrameRate, (double) frameRate);
}
} else if (mime.startsWith("audio/")) {
- mAnalyticsItem->setCString(kPlayerAMime, mime.c_str());
+ mMetricsItem->setCString(kPlayerAMime, mime.c_str());
if (!name.empty()) {
- mAnalyticsItem->setCString(kPlayerACodec, name.c_str());
+ mMetricsItem->setCString(kPlayerACodec, name.c_str());
}
}
}
@@ -598,20 +596,20 @@
// getDuration() uses mLock for mutex -- careful where we use it.
int duration_ms = -1;
getDuration(&duration_ms);
- mAnalyticsItem->setInt64(kPlayerDuration, duration_ms);
+ mMetricsItem->setInt64(kPlayerDuration, duration_ms);
mPlayer->updateInternalTimers();
- mAnalyticsItem->setInt64(kPlayerPlaying, (mPlayingTimeUs+500)/1000 );
+ mMetricsItem->setInt64(kPlayerPlaying, (mPlayingTimeUs+500)/1000 );
if (mRebufferingEvents != 0) {
- mAnalyticsItem->setInt64(kPlayerRebuffering, (mRebufferingTimeUs+500)/1000 );
- mAnalyticsItem->setInt32(kPlayerRebufferingCount, mRebufferingEvents);
- mAnalyticsItem->setInt32(kPlayerRebufferingAtExit, mRebufferingAtExit);
+ mMetricsItem->setInt64(kPlayerRebuffering, (mRebufferingTimeUs+500)/1000 );
+ mMetricsItem->setInt32(kPlayerRebufferingCount, mRebufferingEvents);
+ mMetricsItem->setInt32(kPlayerRebufferingAtExit, mRebufferingAtExit);
}
- mAnalyticsItem->setCString(kPlayerDataSourceType, mPlayer->getDataSourceType());
+ mMetricsItem->setCString(kPlayerDataSourceType, mPlayer->getDataSourceType());
}
@@ -621,7 +619,7 @@
}
ALOGV("logMetrics(%p) from %s at state %d", this, where, mState);
- if (mAnalyticsItem == NULL || mAnalyticsItem->isEnabled() == false) {
+ if (mMetricsItem == NULL || mMetricsItem->isEnabled() == false) {
return;
}
@@ -630,18 +628,18 @@
// and that always injects 3 fields (duration, playing time, and
// datasource) into the record.
// So the canonical "empty" record has 3 elements in it.
- if (mAnalyticsItem->count() > 3) {
+ if (mMetricsItem->count() > 3) {
- mAnalyticsItem->selfrecord();
+ mMetricsItem->selfrecord();
// re-init in case we prepare() and start() again.
- delete mAnalyticsItem ;
- mAnalyticsItem = MediaAnalyticsItem::create(kKeyPlayer);
- if (mAnalyticsItem) {
- mAnalyticsItem->setUid(mClientUid);
+ delete mMetricsItem ;
+ mMetricsItem = mediametrics::Item::create(kKeyPlayer);
+ if (mMetricsItem) {
+ mMetricsItem->setUid(mClientUid);
}
} else {
- ALOGV("nothing to record (only %zu fields)", mAnalyticsItem->count());
+ ALOGV("nothing to record (only %zu fields)", mMetricsItem->count());
}
}
@@ -779,11 +777,11 @@
status_t NuPlayerDriver::getParameter(int key, Parcel *reply) {
- if (key == FOURCC('m','t','r','X') && mAnalyticsItem != NULL) {
+ if (key == FOURCC('m','t','r','X') && mMetricsItem != NULL) {
// mtrX -- a play on 'metrics' (not matrix)
// gather current info all together, parcel it, and send it back
updateMetrics("api");
- mAnalyticsItem->writeToParcel(reply);
+ mMetricsItem->writeToParcel(reply);
return OK;
}
@@ -1007,12 +1005,12 @@
// when we have an error, add it to the analytics for this playback.
// ext1 is our primary 'error type' value. Only add ext2 when non-zero.
// [test against msg is due to fall through from previous switch value]
- if (msg == MEDIA_ERROR && mAnalyticsItem != NULL) {
- mAnalyticsItem->setInt32(kPlayerError, ext1);
+ if (msg == MEDIA_ERROR && mMetricsItem != NULL) {
+ mMetricsItem->setInt32(kPlayerError, ext1);
if (ext2 != 0) {
- mAnalyticsItem->setInt32(kPlayerErrorCode, ext2);
+ mMetricsItem->setInt32(kPlayerErrorCode, ext2);
}
- mAnalyticsItem->setCString(kPlayerErrorState, stateString(mState).c_str());
+ mMetricsItem->setCString(kPlayerErrorState, stateString(mState).c_str());
}
mAtEOS = true;
break;
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
index ad878f8..7001f4a 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.h
@@ -16,7 +16,7 @@
#include <media/MediaPlayerInterface.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/stagefright/foundation/ABase.h>
namespace android {
@@ -141,7 +141,7 @@
sp<AudioSink> mAudioSink;
uint32_t mPlayerFlags;
- MediaAnalyticsItem *mAnalyticsItem;
+ mediametrics::Item *mMetricsItem;
uid_t mClientUid;
bool mAtEOS;
diff --git a/media/libnblog/ReportPerformance.cpp b/media/libnblog/ReportPerformance.cpp
index b050b83..aa678ba 100644
--- a/media/libnblog/ReportPerformance.cpp
+++ b/media/libnblog/ReportPerformance.cpp
@@ -30,7 +30,7 @@
#include <sys/time.h>
#include <utility>
#include <json/json.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/nblog/Events.h>
#include <media/nblog/PerformanceAnalysis.h>
#include <media/nblog/ReportPerformance.h>
@@ -168,7 +168,7 @@
return false;
}
- std::unique_ptr<MediaAnalyticsItem> item(MediaAnalyticsItem::create("audiothread"));
+ std::unique_ptr<mediametrics::Item> item(mediametrics::Item::create("audiothread"));
const Histogram &workHist = data.workHist;
if (workHist.totalCount() > 0) {
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 257dd0f..e516477 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -39,7 +39,7 @@
#include <mediadrm/ICrypto.h>
#include <media/IOMX.h>
#include <media/MediaCodecBuffer.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/MediaResource.h>
#include <media/stagefright/foundation/ABuffer.h>
#include <media/stagefright/foundation/ADebug.h>
diff --git a/media/libstagefright/RemoteMediaExtractor.cpp b/media/libstagefright/RemoteMediaExtractor.cpp
index 29c3a35..2e26fd0 100644
--- a/media/libstagefright/RemoteMediaExtractor.cpp
+++ b/media/libstagefright/RemoteMediaExtractor.cpp
@@ -20,7 +20,7 @@
#include <binder/IPCThreadState.h>
#include <media/stagefright/InterfaceUtils.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/MediaSource.h>
#include <media/stagefright/RemoteMediaExtractor.h>
@@ -48,20 +48,20 @@
mSource(source),
mExtractorPlugin(plugin) {
- mAnalyticsItem = nullptr;
+ mMetricsItem = nullptr;
if (MEDIA_LOG) {
- mAnalyticsItem = MediaAnalyticsItem::create(kKeyExtractor);
+ mMetricsItem = mediametrics::Item::create(kKeyExtractor);
// we're in the extractor service, we want to attribute to the app
// that invoked us.
int uid = IPCThreadState::self()->getCallingUid();
- mAnalyticsItem->setUid(uid);
+ mMetricsItem->setUid(uid);
// track the container format (mpeg, aac, wvm, etc)
size_t ntracks = extractor->countTracks();
- mAnalyticsItem->setCString(kExtractorFormat, extractor->name());
+ mMetricsItem->setCString(kExtractorFormat, extractor->name());
// tracks (size_t)
- mAnalyticsItem->setInt32(kExtractorTracks, ntracks);
+ mMetricsItem->setInt32(kExtractorTracks, ntracks);
// metadata
MetaDataBase pMetaData;
if (extractor->getMetaData(pMetaData) == OK) {
@@ -70,7 +70,7 @@
// 'mime'
const char *mime = nullptr;
if (pMetaData.findCString(kKeyMIMEType, &mime)) {
- mAnalyticsItem->setCString(kExtractorMime, mime);
+ mMetricsItem->setCString(kExtractorMime, mime);
}
// what else is interesting and not already available?
}
@@ -84,15 +84,15 @@
mExtractorPlugin = nullptr;
// log the current record, provided it has some information worth recording
if (MEDIA_LOG) {
- if (mAnalyticsItem != nullptr) {
- if (mAnalyticsItem->count() > 0) {
- mAnalyticsItem->selfrecord();
+ if (mMetricsItem != nullptr) {
+ if (mMetricsItem->count() > 0) {
+ mMetricsItem->selfrecord();
}
}
}
- if (mAnalyticsItem != nullptr) {
- delete mAnalyticsItem;
- mAnalyticsItem = nullptr;
+ if (mMetricsItem != nullptr) {
+ delete mMetricsItem;
+ mMetricsItem = nullptr;
}
}
@@ -123,11 +123,11 @@
}
status_t RemoteMediaExtractor::getMetrics(Parcel *reply) {
- if (mAnalyticsItem == nullptr || reply == nullptr) {
+ if (mMetricsItem == nullptr || reply == nullptr) {
return UNKNOWN_ERROR;
}
- mAnalyticsItem->writeToParcel(reply);
+ mMetricsItem->writeToParcel(reply);
return OK;
}
diff --git a/media/libstagefright/include/media/stagefright/RemoteMediaExtractor.h b/media/libstagefright/include/media/stagefright/RemoteMediaExtractor.h
index 2bf5a8b..e33e303 100644
--- a/media/libstagefright/include/media/stagefright/RemoteMediaExtractor.h
+++ b/media/libstagefright/include/media/stagefright/RemoteMediaExtractor.h
@@ -18,12 +18,12 @@
#define REMOTE_MEDIA_EXTRACTOR_H_
#include <android/IMediaExtractor.h>
+#include <media/MediaMetricsItem.h>
#include <media/stagefright/MediaExtractor.h>
#include <media/stagefright/foundation/ABase.h>
namespace android {
-class MediaAnalyticsItem;
// IMediaExtractor wrapper to the MediaExtractor.
class RemoteMediaExtractor : public BnMediaExtractor {
@@ -48,7 +48,7 @@
sp<DataSource> mSource;
sp<RefBase> mExtractorPlugin;
- MediaAnalyticsItem *mAnalyticsItem;
+ mediametrics::Item *mMetricsItem;
explicit RemoteMediaExtractor(
MediaExtractor *extractor,
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index e70c776..9a16a95 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -1725,7 +1725,7 @@
mLastRecordedTimestampVerifierN = mTimestampVerifier.getN();
mLastRecordedTimeNs = timeNs;
- std::unique_ptr<MediaAnalyticsItem> item(MediaAnalyticsItem::create("audiothread"));
+ std::unique_ptr<mediametrics::Item> item(mediametrics::Item::create("audiothread"));
#define MM_PREFIX "android.media.audiothread." // avoid cut-n-paste errors.
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
index 6379a8a..44c1d09 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
@@ -19,7 +19,7 @@
#include "AudioPolicyService.h"
#include "TypeConverter.h"
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <media/AudioPolicy.h>
#include <utils/Log.h>
@@ -548,7 +548,7 @@
static constexpr char kAudioPolicyActiveDevice[] =
"android.media.audiopolicy.active.device";
- MediaAnalyticsItem *item = MediaAnalyticsItem::create(kAudioPolicy);
+ mediametrics::Item *item = mediametrics::Item::create(kAudioPolicy);
if (item != NULL) {
item->setInt32(kAudioPolicyStatus, status);
diff --git a/services/mediametrics/AudioAnalytics.cpp b/services/mediametrics/AudioAnalytics.cpp
index 638c4ab..fffe517 100644
--- a/services/mediametrics/AudioAnalytics.cpp
+++ b/services/mediametrics/AudioAnalytics.cpp
@@ -35,7 +35,7 @@
}
status_t AudioAnalytics::submit(
- const std::shared_ptr<const MediaAnalyticsItem>& item, bool isTrusted)
+ const std::shared_ptr<const mediametrics::Item>& item, bool isTrusted)
{
if (startsWith(item->getKey(), "audio.")) {
return mTimeMachine.put(item, isTrusted)
diff --git a/services/mediametrics/AudioAnalytics.h b/services/mediametrics/AudioAnalytics.h
index 366a809..b931258 100644
--- a/services/mediametrics/AudioAnalytics.h
+++ b/services/mediametrics/AudioAnalytics.h
@@ -43,7 +43,7 @@
* UID to be a system service by MediaMetrics service.
* Do not use true if you haven't really checked!
*/
- status_t submit(const std::shared_ptr<const MediaAnalyticsItem>& item, bool isTrusted);
+ status_t submit(const std::shared_ptr<const mediametrics::Item>& item, bool isTrusted);
/**
* Returns a pair consisting of the dump string, and the number of lines in the string.
diff --git a/services/mediametrics/MediaMetricsService.cpp b/services/mediametrics/MediaMetricsService.cpp
index b735b81..bbd13fa 100644
--- a/services/mediametrics/MediaMetricsService.cpp
+++ b/services/mediametrics/MediaMetricsService.cpp
@@ -15,7 +15,7 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "MediaAnalyticsService"
+#define LOG_TAG "MediaMetricsService"
#include <utils/Log.h>
#include "MediaMetricsService.h"
@@ -52,21 +52,21 @@
// TODO: need to look at tuning kMaxRecords and friends for low-memory devices
/* static */
-nsecs_t MediaAnalyticsService::roundTime(nsecs_t timeNs)
+nsecs_t MediaMetricsService::roundTime(nsecs_t timeNs)
{
return (timeNs + NANOS_PER_SECOND / 2) / NANOS_PER_SECOND * NANOS_PER_SECOND;
}
-MediaAnalyticsService::MediaAnalyticsService()
+MediaMetricsService::MediaMetricsService()
: mMaxRecords(kMaxRecords),
mMaxRecordAgeNs(kMaxRecordAgeNs),
mMaxRecordsExpiredAtOnce(kMaxExpiredAtOnce),
- mDumpProtoDefault(MediaAnalyticsItem::PROTO_V1)
+ mDumpProtoDefault(mediametrics::Item::PROTO_V1)
{
ALOGD("%s", __func__);
}
-MediaAnalyticsService::~MediaAnalyticsService()
+MediaMetricsService::~MediaMetricsService()
{
ALOGD("%s", __func__);
// the class destructor clears anyhow, but we enforce clearing items first.
@@ -74,7 +74,7 @@
mItems.clear();
}
-status_t MediaAnalyticsService::submitInternal(MediaAnalyticsItem *item, bool release)
+status_t MediaMetricsService::submitInternal(mediametrics::Item *item, bool release)
{
// calling PID is 0 for one-way calls.
const pid_t pid = IPCThreadState::self()->getCallingPid();
@@ -157,23 +157,23 @@
}
// now attach either the item or its dup to a const shared pointer
- std::shared_ptr<const MediaAnalyticsItem> sitem(release ? item : item->dup());
+ std::shared_ptr<const mediametrics::Item> sitem(release ? item : item->dup());
(void)mAudioAnalytics.submit(sitem, isTrusted);
- extern bool dump2Statsd(const std::shared_ptr<const MediaAnalyticsItem>& item);
+ extern bool dump2Statsd(const std::shared_ptr<const mediametrics::Item>& item);
(void)dump2Statsd(sitem); // failure should be logged in function.
saveItem(sitem);
return NO_ERROR;
}
-status_t MediaAnalyticsService::dump(int fd, const Vector<String16>& args)
+status_t MediaMetricsService::dump(int fd, const Vector<String16>& args)
{
String8 result;
if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
result.appendFormat("Permission Denial: "
- "can't dump MediaAnalyticsService from pid=%d, uid=%d\n",
+ "can't dump MediaMetricsService from pid=%d, uid=%d\n",
IPCThreadState::self()->getCallingPid(),
IPCThreadState::self()->getCallingUid());
write(fd, result.string(), result.size());
@@ -198,15 +198,15 @@
i++;
if (i < n) {
String8 value(args[i]);
- int proto = MediaAnalyticsItem::PROTO_V0;
+ int proto = mediametrics::Item::PROTO_V0;
char *endp;
const char *p = value.string();
proto = strtol(p, &endp, 10);
if (endp != p || *endp == '\0') {
- if (proto < MediaAnalyticsItem::PROTO_FIRST) {
- proto = MediaAnalyticsItem::PROTO_FIRST;
- } else if (proto > MediaAnalyticsItem::PROTO_LAST) {
- proto = MediaAnalyticsItem::PROTO_LAST;
+ if (proto < mediametrics::Item::PROTO_FIRST) {
+ proto = mediametrics::Item::PROTO_FIRST;
+ } else if (proto > mediametrics::Item::PROTO_LAST) {
+ proto = mediametrics::Item::PROTO_LAST;
}
chosenProto = proto;
} else {
@@ -275,10 +275,10 @@
}
// dump headers
-void MediaAnalyticsService::dumpHeaders_l(String8 &result, int dumpProto, nsecs_t ts_since)
+void MediaMetricsService::dumpHeaders_l(String8 &result, int dumpProto, nsecs_t ts_since)
{
result.appendFormat("Protocol Version: %d\n", dumpProto);
- if (MediaAnalyticsItem::isEnabled()) {
+ if (mediametrics::Item::isEnabled()) {
result.append("Metrics gathering: enabled\n");
} else {
result.append("Metrics gathering: DISABLED via property\n");
@@ -297,7 +297,7 @@
}
}
-void MediaAnalyticsService::dumpRecent_l(
+void MediaMetricsService::dumpRecent_l(
String8 &result, int dumpProto, nsecs_t ts_since, const char * only)
{
if (only != nullptr && *only == '\0') {
@@ -311,11 +311,11 @@
// talk about # records we discarded, perhaps "discarded w/o reading" too
}
-void MediaAnalyticsService::dumpQueue_l(String8 &result, int dumpProto) {
+void MediaMetricsService::dumpQueue_l(String8 &result, int dumpProto) {
dumpQueue_l(result, dumpProto, (nsecs_t) 0, nullptr /* only */);
}
-void MediaAnalyticsService::dumpQueue_l(
+void MediaMetricsService::dumpQueue_l(
String8 &result, int dumpProto, nsecs_t ts_since, const char * only) {
int slot = 0;
@@ -346,7 +346,7 @@
// if item != NULL, it's the item we just inserted
// true == more items eligible to be recovered
-bool MediaAnalyticsService::expirations_l(const std::shared_ptr<const MediaAnalyticsItem>& item)
+bool MediaMetricsService::expirations_l(const std::shared_ptr<const mediametrics::Item>& item)
{
bool more = false;
@@ -395,7 +395,7 @@
return more;
}
-void MediaAnalyticsService::processExpirations()
+void MediaMetricsService::processExpirations()
{
bool more;
do {
@@ -405,7 +405,7 @@
} while (more);
}
-void MediaAnalyticsService::saveItem(const std::shared_ptr<const MediaAnalyticsItem>& item)
+void MediaMetricsService::saveItem(const std::shared_ptr<const mediametrics::Item>& item)
{
std::lock_guard _l(mLock);
// we assume the items are roughly in time order.
@@ -419,7 +419,7 @@
}
/* static */
-bool MediaAnalyticsService::isContentValid(const MediaAnalyticsItem *item, bool isTrusted)
+bool MediaMetricsService::isContentValid(const mediametrics::Item *item, bool isTrusted)
{
if (isTrusted) return true;
// untrusted uids can only send us a limited set of keys
@@ -445,7 +445,7 @@
}
// are we rate limited, normally false
-bool MediaAnalyticsService::isRateLimited(MediaAnalyticsItem *) const
+bool MediaMetricsService::isRateLimited(mediametrics::Item *) const
{
return false;
}
@@ -455,8 +455,8 @@
// give me the package name, perhaps going to find it
// manages its own mutex operations internally
-void MediaAnalyticsService::UidInfo::setPkgInfo(
- MediaAnalyticsItem *item, uid_t uid, bool setName, bool setVersion)
+void MediaMetricsService::UidInfo::setPkgInfo(
+ mediametrics::Item *item, uid_t uid, bool setName, bool setVersion)
{
ALOGV("%s: uid=%d", __func__, uid);
diff --git a/services/mediametrics/MediaMetricsService.h b/services/mediametrics/MediaMetricsService.h
index 5bdc48f..b736c30 100644
--- a/services/mediametrics/MediaMetricsService.h
+++ b/services/mediametrics/MediaMetricsService.h
@@ -22,19 +22,19 @@
#include <mutex>
#include <unordered_map>
-// IMediaAnalyticsService must include Vector, String16, Errors
-#include <media/IMediaAnalyticsService.h>
+// IMediaMetricsService must include Vector, String16, Errors
+#include <media/IMediaMetricsService.h>
#include <utils/String8.h>
#include "AudioAnalytics.h"
namespace android {
-class MediaAnalyticsService : public BnMediaAnalyticsService
+class MediaMetricsService : public BnMediaMetricsService
{
public:
- MediaAnalyticsService();
- ~MediaAnalyticsService() override;
+ MediaMetricsService();
+ ~MediaMetricsService() override;
/**
* Submits the indicated record to the mediaanalytics service.
@@ -43,12 +43,12 @@
* \return status failure, which is negative on binder transaction failure.
* As the transaction is one-way, remote failures will not be reported.
*/
- status_t submit(MediaAnalyticsItem *item) override {
+ status_t submit(mediametrics::Item *item) override {
return submitInternal(item, false /* release */);
}
status_t submitBuffer(const char *buffer, size_t length) override {
- MediaAnalyticsItem *item = new MediaAnalyticsItem();
+ mediametrics::Item *item = new mediametrics::Item();
return item->readFromByteString(buffer, length)
?: submitInternal(item, true /* release */);
}
@@ -66,17 +66,17 @@
// Internal call where release is true if ownership of item is transferred
// to the service (that is, the service will eventually delete the item).
- status_t submitInternal(MediaAnalyticsItem *item, bool release) override;
+ status_t submitInternal(mediametrics::Item *item, bool release) override;
private:
void processExpirations();
// input validation after arrival from client
- static bool isContentValid(const MediaAnalyticsItem *item, bool isTrusted);
- bool isRateLimited(MediaAnalyticsItem *) const;
- void saveItem(const std::shared_ptr<const MediaAnalyticsItem>& item);
+ static bool isContentValid(const mediametrics::Item *item, bool isTrusted);
+ bool isRateLimited(mediametrics::Item *) const;
+ void saveItem(const std::shared_ptr<const mediametrics::Item>& item);
// The following methods are GUARDED_BY(mLock)
- bool expirations_l(const std::shared_ptr<const MediaAnalyticsItem>& item);
+ bool expirations_l(const std::shared_ptr<const mediametrics::Item>& item);
// support for generating output
void dumpQueue_l(String8 &result, int dumpProto);
@@ -98,7 +98,7 @@
class UidInfo {
public:
- void setPkgInfo(MediaAnalyticsItem *item, uid_t uid, bool setName, bool setVersion);
+ void setPkgInfo(mediametrics::Item *item, uid_t uid, bool setName, bool setVersion);
private:
std::mutex mUidInfoLock;
@@ -132,7 +132,7 @@
// Our item queue, generally (oldest at front)
// TODO: Make separate class, use segmented queue, write lock only end.
// Note: Another analytics module might have ownership of an item longer than the log.
- std::deque<std::shared_ptr<const MediaAnalyticsItem>> mItems; // GUARDED_BY(mLock)
+ std::deque<std::shared_ptr<const mediametrics::Item>> mItems; // GUARDED_BY(mLock)
};
} // namespace android
diff --git a/services/mediametrics/TimeMachine.h b/services/mediametrics/TimeMachine.h
index 578b838..0cd8dc6 100644
--- a/services/mediametrics/TimeMachine.h
+++ b/services/mediametrics/TimeMachine.h
@@ -23,7 +23,7 @@
#include <variant>
#include <vector>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
#include <utils/Timers.h>
namespace android::mediametrics {
@@ -101,7 +101,7 @@
}
void putProp(
- const std::string &name, const MediaAnalyticsItem::Prop &prop, int64_t time = 0) {
+ const std::string &name, const mediametrics::Item::Prop &prop, int64_t time = 0) {
prop.visit([&](auto value) { putValue(name, value, time); });
}
@@ -188,7 +188,7 @@
/**
* Put all the properties from an item into the Time Machine log.
*/
- status_t put(const std::shared_ptr<const MediaAnalyticsItem>& item, bool isTrusted = false) {
+ status_t put(const std::shared_ptr<const mediametrics::Item>& item, bool isTrusted = false) {
const int64_t time = item->getTimestamp();
const std::string &key = item->getKey();
@@ -214,7 +214,7 @@
}
// deferred contains remote properties (for other keys) to do later.
- std::vector<const MediaAnalyticsItem::Prop *> deferred;
+ std::vector<const mediametrics::Item::Prop *> deferred;
{
// handle local properties
std::lock_guard lock(getLockForKey(key));
diff --git a/services/mediametrics/TransactionLog.h b/services/mediametrics/TransactionLog.h
index ca37862..7a520d9 100644
--- a/services/mediametrics/TransactionLog.h
+++ b/services/mediametrics/TransactionLog.h
@@ -21,12 +21,12 @@
#include <sstream>
#include <string>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
namespace android::mediametrics {
/**
- * The TransactionLog is used to record MediaAnalyticsItems to present
+ * The TransactionLog is used to record mediametrics::Items to present
* different views on the time information (selected by audio, and sorted by key).
*
* The TransactionLog will always present data in timestamp order. (Perhaps we
@@ -61,7 +61,7 @@
/**
* Put an item in the TransactionLog.
*/
- status_t put(const std::shared_ptr<const MediaAnalyticsItem>& item) {
+ status_t put(const std::shared_ptr<const mediametrics::Item>& item) {
const std::string& key = item->getKey();
const int64_t time = item->getTimestamp();
@@ -77,7 +77,7 @@
/**
* Returns all records within [startTime, endTime]
*/
- std::vector<std::shared_ptr<const MediaAnalyticsItem>> get(
+ std::vector<std::shared_ptr<const mediametrics::Item>> get(
int64_t startTime = 0, int64_t endTime = INT64_MAX) const {
std::lock_guard lock(mLock);
return getItemsInRange_l(mLog, startTime, endTime);
@@ -86,7 +86,7 @@
/**
* Returns all records for a key within [startTime, endTime]
*/
- std::vector<std::shared_ptr<const MediaAnalyticsItem>> get(
+ std::vector<std::shared_ptr<const mediametrics::Item>> get(
const std::string& key,
int64_t startTime = 0, int64_t endTime = INT64_MAX) const {
std::lock_guard lock(mLock);
@@ -158,7 +158,7 @@
private:
using MapTimeItem =
- std::multimap<int64_t /* time */, std::shared_ptr<const MediaAnalyticsItem>>;
+ std::multimap<int64_t /* time */, std::shared_ptr<const mediametrics::Item>>;
// GUARDED_BY mLock
/**
@@ -179,7 +179,7 @@
// remove at least those elements.
// use a stale vector with precise type to avoid type erasure overhead in garbage
- std::vector<std::shared_ptr<const MediaAnalyticsItem>> stale;
+ std::vector<std::shared_ptr<const mediametrics::Item>> stale;
for (size_t i = 0; i < toRemove; ++i) {
stale.emplace_back(std::move(eraseEnd->second));
@@ -224,7 +224,7 @@
return true;
}
- static std::vector<std::shared_ptr<const MediaAnalyticsItem>> getItemsInRange_l(
+ static std::vector<std::shared_ptr<const mediametrics::Item>> getItemsInRange_l(
const MapTimeItem& map,
int64_t startTime = 0, int64_t endTime = INT64_MAX) {
auto it = map.lower_bound(startTime);
@@ -232,7 +232,7 @@
auto it2 = map.upper_bound(endTime);
- std::vector<std::shared_ptr<const MediaAnalyticsItem>> ret;
+ std::vector<std::shared_ptr<const mediametrics::Item>> ret;
while (it != it2) {
ret.push_back(it->second);
++it;
diff --git a/services/mediametrics/iface_statsd.cpp b/services/mediametrics/iface_statsd.cpp
index 962cafe..3a1eea7 100644
--- a/services/mediametrics/iface_statsd.cpp
+++ b/services/mediametrics/iface_statsd.cpp
@@ -38,10 +38,10 @@
namespace android {
-// set of routines that crack a MediaAnalyticsItem
+// set of routines that crack a mediametrics::Item
// and send it off to statsd with the appropriate hooks
//
-// each MediaAnalyticsItem type (extractor, codec, nuplayer, etc)
+// each mediametrics::Item type (extractor, codec, nuplayer, etc)
// has its own routine to handle this.
//
@@ -49,7 +49,7 @@
struct statsd_hooks {
const char *key;
- bool (*handler)(const MediaAnalyticsItem *);
+ bool (*handler)(const mediametrics::Item *);
};
// keep this sorted, so we can do binary searches
@@ -70,7 +70,7 @@
};
// give me a record, i'll look at the type and upload appropriately
-bool dump2Statsd(const std::shared_ptr<const MediaAnalyticsItem>& item) {
+bool dump2Statsd(const std::shared_ptr<const mediametrics::Item>& item) {
if (item == NULL) return false;
// get the key
diff --git a/services/mediametrics/iface_statsd.h b/services/mediametrics/iface_statsd.h
index 1c48118..19505a4 100644
--- a/services/mediametrics/iface_statsd.h
+++ b/services/mediametrics/iface_statsd.h
@@ -19,17 +19,17 @@
extern bool enabled_statsd;
// component specific dumpers
-extern bool statsd_audiopolicy(const MediaAnalyticsItem *);
-extern bool statsd_audiorecord(const MediaAnalyticsItem *);
-extern bool statsd_audiothread(const MediaAnalyticsItem *);
-extern bool statsd_audiotrack(const MediaAnalyticsItem *);
-extern bool statsd_codec(const MediaAnalyticsItem *);
-extern bool statsd_extractor(const MediaAnalyticsItem *);
-extern bool statsd_nuplayer(const MediaAnalyticsItem *);
-extern bool statsd_recorder(const MediaAnalyticsItem *);
+extern bool statsd_audiopolicy(const mediametrics::Item *);
+extern bool statsd_audiorecord(const mediametrics::Item *);
+extern bool statsd_audiothread(const mediametrics::Item *);
+extern bool statsd_audiotrack(const mediametrics::Item *);
+extern bool statsd_codec(const mediametrics::Item *);
+extern bool statsd_extractor(const mediametrics::Item *);
+extern bool statsd_nuplayer(const mediametrics::Item *);
+extern bool statsd_recorder(const mediametrics::Item *);
-extern bool statsd_mediadrm(const MediaAnalyticsItem *);
-extern bool statsd_widevineCDM(const MediaAnalyticsItem *);
-extern bool statsd_drmmanager(const MediaAnalyticsItem *);
+extern bool statsd_mediadrm(const mediametrics::Item *);
+extern bool statsd_widevineCDM(const mediametrics::Item *);
+extern bool statsd_drmmanager(const mediametrics::Item *);
} // namespace android
diff --git a/services/mediametrics/main_mediametrics.cpp b/services/mediametrics/main_mediametrics.cpp
index 4b2a9fa..ec392e2 100644
--- a/services/mediametrics/main_mediametrics.cpp
+++ b/services/mediametrics/main_mediametrics.cpp
@@ -34,10 +34,10 @@
// to match the service name
// we're replacing "/system/bin/mediametrics" with "media.metrics"
// we add a ".", but discard the path components: we finish with a shorter string
- strcpy(argv[0], MediaAnalyticsService::kServiceName);
+ strcpy(argv[0], MediaMetricsService::kServiceName);
defaultServiceManager()->addService(
- String16(MediaAnalyticsService::kServiceName), new MediaAnalyticsService());
+ String16(MediaMetricsService::kServiceName), new MediaMetricsService());
sp<ProcessState> processState(ProcessState::self());
// processState->setThreadPoolMaxThreadCount(8);
diff --git a/services/mediametrics/statsd_audiopolicy.cpp b/services/mediametrics/statsd_audiopolicy.cpp
index 2f934f8..634c801 100644
--- a/services/mediametrics/statsd_audiopolicy.cpp
+++ b/services/mediametrics/statsd_audiopolicy.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_audiopolicy(const MediaAnalyticsItem *item)
+bool statsd_audiopolicy(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_audiorecord.cpp b/services/mediametrics/statsd_audiorecord.cpp
index 4e2829d..69d1661 100644
--- a/services/mediametrics/statsd_audiorecord.cpp
+++ b/services/mediametrics/statsd_audiorecord.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_audiorecord(const MediaAnalyticsItem *item)
+bool statsd_audiorecord(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_audiothread.cpp b/services/mediametrics/statsd_audiothread.cpp
index a5bfcba..300151b 100644
--- a/services/mediametrics/statsd_audiothread.cpp
+++ b/services/mediametrics/statsd_audiothread.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_audiothread(const MediaAnalyticsItem *item)
+bool statsd_audiothread(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_audiotrack.cpp b/services/mediametrics/statsd_audiotrack.cpp
index 9d76d43..397cdf3 100644
--- a/services/mediametrics/statsd_audiotrack.cpp
+++ b/services/mediametrics/statsd_audiotrack.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_audiotrack(const MediaAnalyticsItem *item)
+bool statsd_audiotrack(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_codec.cpp b/services/mediametrics/statsd_codec.cpp
index fde0bfa..214c51a 100644
--- a/services/mediametrics/statsd_codec.cpp
+++ b/services/mediametrics/statsd_codec.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_codec(const MediaAnalyticsItem *item)
+bool statsd_codec(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_drm.cpp b/services/mediametrics/statsd_drm.cpp
index 78d0a22..b12f4f3 100644
--- a/services/mediametrics/statsd_drm.cpp
+++ b/services/mediametrics/statsd_drm.cpp
@@ -38,11 +38,11 @@
namespace android {
// mediadrm
-bool statsd_mediadrm(const MediaAnalyticsItem *item)
+bool statsd_mediadrm(const mediametrics::Item *item)
{
if (item == NULL) return false;
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
@@ -75,11 +75,11 @@
}
// widevineCDM
-bool statsd_widevineCDM(const MediaAnalyticsItem *item)
+bool statsd_widevineCDM(const mediametrics::Item *item)
{
if (item == NULL) return false;
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
@@ -105,11 +105,11 @@
}
// drmmanager
-bool statsd_drmmanager(const MediaAnalyticsItem *item)
+bool statsd_drmmanager(const mediametrics::Item *item)
{
if (item == NULL) return false;
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_extractor.cpp b/services/mediametrics/statsd_extractor.cpp
index cc62241..8574358 100644
--- a/services/mediametrics/statsd_extractor.cpp
+++ b/services/mediametrics/statsd_extractor.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_extractor(const MediaAnalyticsItem *item)
+bool statsd_extractor(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_nuplayer.cpp b/services/mediametrics/statsd_nuplayer.cpp
index 9db1e81..df7e59f 100644
--- a/services/mediametrics/statsd_nuplayer.cpp
+++ b/services/mediametrics/statsd_nuplayer.cpp
@@ -41,12 +41,12 @@
* handles nuplayer AND nuplayer2
* checks for the union of what the two players generate
*/
-bool statsd_nuplayer(const MediaAnalyticsItem *item)
+bool statsd_nuplayer(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/statsd_recorder.cpp b/services/mediametrics/statsd_recorder.cpp
index 972a221..4de1746 100644
--- a/services/mediametrics/statsd_recorder.cpp
+++ b/services/mediametrics/statsd_recorder.cpp
@@ -37,12 +37,12 @@
namespace android {
-bool statsd_recorder(const MediaAnalyticsItem *item)
+bool statsd_recorder(const mediametrics::Item *item)
{
if (item == NULL) return false;
// these go into the statsd wrapper
- const nsecs_t timestamp = MediaAnalyticsService::roundTime(item->getTimestamp());
+ const nsecs_t timestamp = MediaMetricsService::roundTime(item->getTimestamp());
std::string pkgName = item->getPkgName();
int64_t pkgVersionCode = item->getPkgVersionCode();
int64_t mediaApexVersion = 0;
diff --git a/services/mediametrics/tests/mediametrics_tests.cpp b/services/mediametrics/tests/mediametrics_tests.cpp
index 808da7b..285a1ba 100644
--- a/services/mediametrics/tests/mediametrics_tests.cpp
+++ b/services/mediametrics/tests/mediametrics_tests.cpp
@@ -22,7 +22,7 @@
#include <stdio.h>
#include <gtest/gtest.h>
-#include <media/MediaAnalyticsItem.h>
+#include <media/MediaMetricsItem.h>
using namespace android;
@@ -36,11 +36,11 @@
}
TEST(mediametrics_tests, instantiate) {
- sp mediaMetrics = new MediaAnalyticsService();
+ sp mediaMetrics = new MediaMetricsService();
status_t status;
// random keys ignored when empty
- std::unique_ptr<MediaAnalyticsItem> random_key(MediaAnalyticsItem::create("random_key"));
+ std::unique_ptr<mediametrics::Item> random_key(mediametrics::Item::create("random_key"));
status = mediaMetrics->submit(random_key.get());
ASSERT_EQ(PERMISSION_DENIED, status);
@@ -50,7 +50,7 @@
ASSERT_EQ(PERMISSION_DENIED, status);
// known keys ignored if empty
- std::unique_ptr<MediaAnalyticsItem> audiotrack_key(MediaAnalyticsItem::create("audiotrack"));
+ std::unique_ptr<mediametrics::Item> audiotrack_key(mediametrics::Item::create("audiotrack"));
status = mediaMetrics->submit(audiotrack_key.get());
ASSERT_EQ(BAD_VALUE, status);
@@ -62,7 +62,7 @@
/*
// fluent style that goes directly to mediametrics
- ASSERT_EQ(true, MediaAnalyticsItem("audiorecord")
+ ASSERT_EQ(true, mediametrics::Item("audiorecord")
.setInt32("value", 2)
.addInt32("bar", 1)
.addInt32("value", 3)
@@ -73,7 +73,7 @@
}
TEST(mediametrics_tests, item_manipulation) {
- MediaAnalyticsItem item("audiorecord");
+ mediametrics::Item item("audiorecord");
item.setInt32("value", 2).addInt32("bar", 3).addInt32("value", 4);
@@ -128,14 +128,14 @@
printf("item: %s\n", item.toString().c_str());
fflush(stdout);
- sp mediaMetrics = new MediaAnalyticsService();
+ sp mediaMetrics = new MediaMetricsService();
status_t status = mediaMetrics->submit(&item);
ASSERT_EQ(NO_ERROR, status);
mediaMetrics->dump(fileno(stdout), {} /* args */);
}
TEST(mediametrics_tests, superbig_item) {
- MediaAnalyticsItem item("TheBigOne");
+ mediametrics::Item item("TheBigOne");
constexpr size_t count = 10000;
for (size_t i = 0; i < count; ++i) {
@@ -149,7 +149,7 @@
}
TEST(mediametrics_tests, superbig_item_removal) {
- MediaAnalyticsItem item("TheOddBigOne");
+ mediametrics::Item item("TheOddBigOne");
constexpr size_t count = 10000;
for (size_t i = 0; i < count; ++i) {
@@ -170,7 +170,7 @@
}
TEST(mediametrics_tests, superbig_item_removal2) {
- MediaAnalyticsItem item("TheOne");
+ mediametrics::Item item("TheOne");
constexpr size_t count = 10000;
for (size_t i = 0; i < count; ++i) {
@@ -191,7 +191,7 @@
}
TEST(mediametrics_tests, item_transmutation) {
- MediaAnalyticsItem item("Alchemist's Stone");
+ mediametrics::Item item("Alchemist's Stone");
item.setInt64("convert", 123);
int64_t i64;
@@ -207,7 +207,7 @@
}
TEST(mediametrics_tests, item_binderization) {
- MediaAnalyticsItem item;
+ mediametrics::Item item;
item.setInt32("i32", 1)
.setInt64("i64", 2)
.setDouble("double", 3.1)
@@ -218,14 +218,14 @@
item.writeToParcel(&p);
p.setDataPosition(0); // rewind for reading
- MediaAnalyticsItem item2;
+ mediametrics::Item item2;
item2.readFromParcel(p);
ASSERT_EQ(item, item2);
}
TEST(mediametrics_tests, item_byteserialization) {
- MediaAnalyticsItem item;
+ mediametrics::Item item;
item.setInt32("i32", 1)
.setInt64("i64", 2)
.setDouble("double", 3.1)
@@ -237,7 +237,7 @@
ASSERT_EQ(0, item.writeToByteString(&data, &length));
ASSERT_GT(length, (size_t)0);
- MediaAnalyticsItem item2;
+ mediametrics::Item item2;
item2.readFromByteString(data, length);
printf("item: %s\n", item.toString().c_str());
@@ -248,7 +248,7 @@
}
TEST(mediametrics_tests, item_iteration) {
- MediaAnalyticsItem item;
+ mediametrics::Item item;
item.setInt32("i32", 1)
.setInt64("i64", 2)
.setDouble("double", 3.125)
@@ -292,7 +292,7 @@
}
TEST(mediametrics_tests, item_expansion) {
- mediametrics::Item<1> item("I");
+ mediametrics::LogItem<1> item("I");
item.set("i32", (int32_t)1)
.set("i64", (int64_t)2)
.set("double", (double)3.125)
@@ -300,7 +300,7 @@
.set("rate", std::pair<int64_t, int64_t>(11, 12));
ASSERT_TRUE(item.updateHeader());
- MediaAnalyticsItem item2;
+ mediametrics::Item item2;
item2.readFromByteString(item.getBuffer(), item.getLength());
ASSERT_EQ((pid_t)-1, item2.getPid());
ASSERT_EQ((uid_t)-1, item2.getUid());
@@ -341,7 +341,7 @@
}
TEST(mediametrics_tests, item_expansion2) {
- mediametrics::Item<1> item("Bigly");
+ mediametrics::LogItem<1> item("Bigly");
item.setPid(123)
.setUid(456);
constexpr size_t count = 10000;
@@ -352,7 +352,7 @@
}
ASSERT_TRUE(item.updateHeader());
- MediaAnalyticsItem item2;
+ mediametrics::Item item2;
printf("begin buffer:%p length:%zu\n", item.getBuffer(), item.getLength());
fflush(stdout);
item2.readFromByteString(item.getBuffer(), item.getLength());
@@ -367,7 +367,7 @@
}
TEST(mediametrics_tests, time_machine_storage) {
- auto item = std::make_shared<MediaAnalyticsItem>("Key");
+ auto item = std::make_shared<mediametrics::Item>("Key");
(*item).set("i32", (int32_t)1)
.set("i64", (int64_t)2)
.set("double", (double)3.125)
@@ -414,21 +414,21 @@
}
TEST(mediametrics_tests, time_machine_remote_key) {
- auto item = std::make_shared<MediaAnalyticsItem>("Key1");
+ auto item = std::make_shared<mediametrics::Item>("Key1");
(*item).set("one", (int32_t)1)
.set("two", (int32_t)2);
android::mediametrics::TimeMachine timeMachine;
ASSERT_EQ(NO_ERROR, timeMachine.put(item, true));
- auto item2 = std::make_shared<MediaAnalyticsItem>("Key2");
+ auto item2 = std::make_shared<mediametrics::Item>("Key2");
(*item2).set("three", (int32_t)3)
.set("[Key1]four", (int32_t)4) // affects Key1
.set("[Key1]five", (int32_t)5); // affects key1
ASSERT_EQ(NO_ERROR, timeMachine.put(item2, true));
- auto item3 = std::make_shared<MediaAnalyticsItem>("Key2");
+ auto item3 = std::make_shared<mediametrics::Item>("Key2");
(*item3).set("six", (int32_t)6)
.set("[Key1]seven", (int32_t)7); // affects Key1
@@ -464,7 +464,7 @@
}
TEST(mediametrics_tests, time_machine_gc) {
- auto item = std::make_shared<MediaAnalyticsItem>("Key1");
+ auto item = std::make_shared<mediametrics::Item>("Key1");
(*item).set("one", (int32_t)1)
.set("two", (int32_t)2)
.setTimestamp(10);
@@ -477,7 +477,7 @@
ASSERT_EQ((size_t)1, timeMachine.size());
- auto item2 = std::make_shared<MediaAnalyticsItem>("Key2");
+ auto item2 = std::make_shared<mediametrics::Item>("Key2");
(*item2).set("three", (int32_t)3)
.set("[Key1]three", (int32_t)3)
.setTimestamp(11);
@@ -487,7 +487,7 @@
//printf("Before\n%s\n\n", timeMachine.dump().c_str());
- auto item3 = std::make_shared<MediaAnalyticsItem>("Key3");
+ auto item3 = std::make_shared<mediametrics::Item>("Key3");
(*item3).set("six", (int32_t)6)
.set("[Key1]four", (int32_t)4) // affects Key1
.set("[Key1]five", (int32_t)5) // affects key1
@@ -515,7 +515,7 @@
}
TEST(mediametrics_tests, transaction_log_gc) {
- auto item = std::make_shared<MediaAnalyticsItem>("Key1");
+ auto item = std::make_shared<mediametrics::Item>("Key1");
(*item).set("one", (int32_t)1)
.set("two", (int32_t)2)
.setTimestamp(10);
@@ -526,7 +526,7 @@
ASSERT_EQ(NO_ERROR, transactionLog.put(item));
ASSERT_EQ((size_t)1, transactionLog.size());
- auto item2 = std::make_shared<MediaAnalyticsItem>("Key2");
+ auto item2 = std::make_shared<mediametrics::Item>("Key2");
(*item2).set("three", (int32_t)3)
.set("[Key1]three", (int32_t)3)
.setTimestamp(11);
@@ -534,7 +534,7 @@
ASSERT_EQ(NO_ERROR, transactionLog.put(item2));
ASSERT_EQ((size_t)2, transactionLog.size());
- auto item3 = std::make_shared<MediaAnalyticsItem>("Key3");
+ auto item3 = std::make_shared<mediametrics::Item>("Key3");
(*item3).set("six", (int32_t)6)
.set("[Key1]four", (int32_t)4) // affects Key1
.set("[Key1]five", (int32_t)5) // affects key1
@@ -545,16 +545,16 @@
}
TEST(mediametrics_tests, audio_analytics_permission) {
- auto item = std::make_shared<MediaAnalyticsItem>("audio.1");
+ auto item = std::make_shared<mediametrics::Item>("audio.1");
(*item).set("one", (int32_t)1)
.set("two", (int32_t)2)
.setTimestamp(10);
- auto item2 = std::make_shared<MediaAnalyticsItem>("audio.1");
+ auto item2 = std::make_shared<mediametrics::Item>("audio.1");
(*item2).set("three", (int32_t)3)
.setTimestamp(11);
- auto item3 = std::make_shared<MediaAnalyticsItem>("audio.2");
+ auto item3 = std::make_shared<mediametrics::Item>("audio.2");
(*item3).set("four", (int32_t)4)
.setTimestamp(12);
@@ -577,16 +577,16 @@
}
TEST(mediametrics_tests, audio_analytics_dump) {
- auto item = std::make_shared<MediaAnalyticsItem>("audio.1");
+ auto item = std::make_shared<mediametrics::Item>("audio.1");
(*item).set("one", (int32_t)1)
.set("two", (int32_t)2)
.setTimestamp(10);
- auto item2 = std::make_shared<MediaAnalyticsItem>("audio.1");
+ auto item2 = std::make_shared<mediametrics::Item>("audio.1");
(*item2).set("three", (int32_t)3)
.setTimestamp(11);
- auto item3 = std::make_shared<MediaAnalyticsItem>("audio.2");
+ auto item3 = std::make_shared<mediametrics::Item>("audio.2");
(*item3).set("four", (int32_t)4)
.setTimestamp(12);