Skip to content

Commit d217590

Browse files
lashminthaLashminthaJ
authored andcommitted
VPLAY-12472 [CSAT][AAMP] Add logging for buffering start/end and buffering duration
Reason for change: Added buffering duration in the telementary along with buffer start and end Risks: Low Test Procedure: Refer jira ticket Priority: P1 Signed-off-by: lashminthaj <lashminthaj17@gmail.com>
1 parent 86796f7 commit d217590

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

priv_aamp.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,7 +1634,7 @@ int PrivateInstanceAAMP::HandleSSLProgressCallback ( void *clientp, double dltot
16341634
/**
16351635
* @brief PrivateInstanceAAMP Constructor
16361636
*/
1637-
PrivateInstanceAAMP::PrivateInstanceAAMP(AampConfig *config) : mReportProgressPosn(0.0), mLastTelemetryTimeMS(0), mDiscontinuityFound(false), mTelemetryInterval(0), mLock(),
1637+
PrivateInstanceAAMP::PrivateInstanceAAMP(AampConfig *config) : mReportProgressPosn(0.0), mLastTelemetryTimeMS(0),mBufferingStartTimeMS(-1), mDiscontinuityFound(false), mTelemetryInterval(0), mLock(),
16381638
mpStreamAbstractionAAMP(NULL), mInitSuccess(false), mVideoFormat(FORMAT_INVALID), mAudioFormat(FORMAT_INVALID), mDownloadsDisabled(),
16391639
mDownloadsEnabled(true), profiler(), licenceFromManifest(false), previousAudioType(eAUDIO_UNKNOWN),isPreferredDRMConfigured(false),
16401640
mbDownloadsBlocked(false), streamerIsActive(false), mFogTSBEnabled(false), mIscDVR(false), mLiveOffset(AAMP_LIVE_OFFSET),
@@ -3249,11 +3249,29 @@ void PrivateInstanceAAMP::SendBufferChangeEvent(bool bufferingStopped)
32493249
BufferingChangedEventPtr e = std::make_shared<BufferingChangedEvent>(!bufferingStopped, GetSessionId());
32503250

32513251
SetBufUnderFlowStatus(bufferingStopped);
3252-
AAMPLOG_INFO("PrivateInstanceAAMP: Sending Buffer Change event status (Buffering): %s", (e->buffering() ? "End": "Start"));
3252+
//Calculating the duration for which buffering was happening and sending it as part of telemetry.
3253+
//This will help in understanding the buffering duration for each buffering event and also help in calculating the total buffering duration for a session.
3254+
long long bufferingDurationMs = 0;
3255+
if (bufferingStopped)
3256+
{
3257+
mBufferingStartTimeMS = aamp_GetCurrentTimeMS();
3258+
}
3259+
else
3260+
{
3261+
if (mBufferingStartTimeMS >= 0)
3262+
{
3263+
bufferingDurationMs = aamp_GetCurrentTimeMS() - mBufferingStartTimeMS;
3264+
mBufferingStartTimeMS = -1;
3265+
}
3266+
}
3267+
3268+
AAMPLOG_INFO("PrivateInstanceAAMP: Sending Buffer Change event status (Buffering): %s durationMs: %lld", (e->buffering() ? "End": "Start"), bufferingDurationMs);
32533269
#ifdef AAMP_TELEMETRY_SUPPORT
32543270
AAMPTelemetry2 at2(mAppName);
32553271
std::string telemetryName = bufferingStopped?"VideoBufferingStart":"VideoBufferingEnd";
3256-
at2.send(telemetryName,{/*int data*/},{/*string data*/},{/*float data*/});
3272+
std::map<std::string,int> intData;
3273+
intData["dur"] = static_cast<int>(bufferingDurationMs);
3274+
at2.send(telemetryName, intData, {/*string data*/}, {/*float data*/});
32573275
#endif //AAMP_TELEMETRY_SUPPORT
32583276
SendEvent(e,AAMP_EVENT_ASYNC_MODE);
32593277
}

priv_aamp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ class PrivateInstanceAAMP : public DrmCallbacks, public std::enable_shared_from_
585585
//The position previously reported by MonitorProgress() (i.e. the position really sent, using SendEvent())
586586
double mReportProgressPosn;
587587
long long mLastTelemetryTimeMS;
588+
// The time when buffering started, used to calculate buffering duration for telemetry
589+
long long mBufferingStartTimeMS;
588590
std::chrono::system_clock::time_point m_lastSubClockSyncTime;
589591
std::shared_ptr<TSB::Store> mTSBStore; /**< Local TSB Store object */
590592
void SanitizeLanguageList(std::vector<std::string>& languages) const;

0 commit comments

Comments
 (0)