better playback time tracking in nuplayer
Fixes problem where playback time was being cleared as part of
a reset before media.metrics stats were logged.
Added code so that getMetrics() calls will return proper in-progress
playback time (previously, playback time was added to the metrics data
only at the end).
Added initialization of timestamp tracking pauses for rebuffering.
Bug: 74008613
Test: dumpsys media.metrics observation
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
index c455951..731fdba 100644
--- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
+++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
@@ -535,6 +535,7 @@
}
void NuPlayerDriver::updateMetrics(const char *where) {
+
if (where == NULL) {
where = "unknown";
}
@@ -592,6 +593,8 @@
getDuration(&duration_ms);
mAnalyticsItem->setInt64(kPlayerDuration, duration_ms);
+ mPlayer->updateInternalTimers();
+
mAnalyticsItem->setInt64(kPlayerPlaying, (mPlayingTimeUs+500)/1000 );
if (mRebufferingEvents != 0) {
@@ -630,7 +633,7 @@
mAnalyticsItem->setUid(mClientUid);
}
} else {
- ALOGV("did not have anything to record");
+ ALOGV("nothing to record (only %d fields)", mAnalyticsItem->count());
}
}