Skip to content

Commit 65786fd

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 1e0605f commit 65786fd

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
@@ -1635,7 +1635,7 @@ int PrivateInstanceAAMP::HandleSSLProgressCallback ( void *clientp, double dltot
16351635
/**
16361636
* @brief PrivateInstanceAAMP Constructor
16371637
*/
1638-
PrivateInstanceAAMP::PrivateInstanceAAMP(AampConfig *config) : mReportProgressPosn(0.0), mLastTelemetryTimeMS(0), mDiscontinuityFound(false), mTelemetryInterval(0), mLock(),
1638+
PrivateInstanceAAMP::PrivateInstanceAAMP(AampConfig *config) : mReportProgressPosn(0.0), mLastTelemetryTimeMS(0),mBufferingStartTimeMS(-1), mDiscontinuityFound(false), mTelemetryInterval(0), mLock(),
16391639
mpStreamAbstractionAAMP(NULL), mInitSuccess(false), mVideoFormat(FORMAT_INVALID), mAudioFormat(FORMAT_INVALID), mDownloadsDisabled(),
16401640
mDownloadsEnabled(true), profiler(), licenceFromManifest(false), previousAudioType(eAUDIO_UNKNOWN),isPreferredDRMConfigured(false),
16411641
mbDownloadsBlocked(false), streamerIsActive(false), mFogTSBEnabled(false), mIscDVR(false), mLiveOffset(AAMP_LIVE_OFFSET),
@@ -3246,11 +3246,29 @@ void PrivateInstanceAAMP::SendBufferChangeEvent(bool bufferingStopped)
32463246
BufferingChangedEventPtr e = std::make_shared<BufferingChangedEvent>(!bufferingStopped, GetSessionId());
32473247

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

priv_aamp.h

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

0 commit comments

Comments
 (0)