Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.
/ rdk-aamp Public archive

Commit d6210de

Browse files
Reshma-001pmaria904
authored and
pmaria904
committed
RDK-37712: [RDK-37711] -[AAMP]Common-Media-Client-Data (CMCD) extensions
Reason for change: Read Network metrics like startTransferTime, totalTime, dnsLookuptime and send it along with CMCD Headers. Also adding enableCMCD player config to fog. Test Procedure: Tested steps on ticket Risks: Medium Signed-off-by: Reshma Raphael <[email protected]> Change-Id: I0e03941b0b2cdb7aa5df5df469630e2ac44f39a4
1 parent 0c55d3b commit d6210de

10 files changed

+173
-147
lines changed

AampConfig.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ void AampConfig::Initialize()
480480
bAampCfgValue[eAAMPConfig_EnableCurlStore].value = true;
481481
bAampCfgValue[eAAMPConfig_RuntimeDRMConfig].value = false;
482482
bAampCfgValue[eAAMPConfig_EnablePublishingMuxedAudio].value = false;
483-
bAampCfgValue[eAAMPConfig_EnableCMCD].value = false;
483+
bAampCfgValue[eAAMPConfig_EnableCMCD].value = true;
484484
bAampCfgValue[eAAMPConfig_EnableSlowMotion].value = true;
485485
bAampCfgValue[eAAMPConfig_EnableSCTE35PresentationTime].value = false;
486486

MediaStreamContext.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ bool MediaStreamContext::CacheFragment(std::string fragmentUrl, unsigned int cur
9090

9191
if(!bReadfromcache)
9292
{
93-
ret = aamp->LoadFragment(bucketType, fragmentUrl,effectiveUrl, &cachedFragment->fragment, curlInstance,
93+
ret = aamp->LoadFragment(pCMCDMetrics,bucketType, fragmentUrl,effectiveUrl, &cachedFragment->fragment, curlInstance,
9494
range, actualType, &httpErrorCode, &downloadTime, &bitrate, &iFogError, fragmentDurationSeconds );
9595
if ( initSegment && ret )
96-
aamp->getAampCacheHandler()->InsertToInitFragCache ( fragmentUrl, &cachedFragment->fragment, effectiveUrl, actualType);
96+
aamp->getAampCacheHandler()->InsertToInitFragCache ( fragmentUrl, &cachedFragment->fragment, effectiveUrl, actualType);
9797
}
9898

9999
if (iCurrentRate != AAMP_NORMAL_PLAY_RATE)

MediaStreamContext.h

+13-2
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,21 @@ class MediaStreamContext : public MediaTrack
5050
lastSegmentTime(0), lastSegmentNumber(0), lastSegmentDuration(0), adaptationSetIdx(0), representationIndex(0), profileChanged(true),
5151
adaptationSetId(0), fragmentDescriptor(), context(ctx), initialization(""),
5252
mDownloadedFragment(), discontinuity(false), mSkipSegmentOnError(true),
53-
downloadedDuration(0)
54-
, scaledPTO(0)
53+
downloadedDuration(0)//,mCMCDNetworkMetrics{-1,-1,-1}
54+
, scaledPTO(0),pCMCDMetrics(NULL)
5555
, failAdjacentSegment(false),httpErrorCode(0)
5656
{
5757
memset(&mDownloadedFragment, 0, sizeof(GrowableBuffer));
5858
fragmentDescriptor.bUseMatchingBaseUrl = ISCONFIGSET(eAAMPConfig_MatchBaseUrl);
59+
if(ISCONFIGSET(eAAMPConfig_EnableCMCD))
60+
{
61+
if(mediaType == eMEDIATYPE_VIDEO)
62+
pCMCDMetrics = new VideoCMCDHeaders();
63+
else if(mediaType == eMEDIATYPE_AUDIO)
64+
pCMCDMetrics = new AudioCMCDHeaders();
65+
else if(mediaType == eMEDIATYPE_SUBTITLE)
66+
pCMCDMetrics = new SubtitleCMCDHeaders();
67+
}
5968
}
6069

6170
/**
@@ -64,6 +73,7 @@ class MediaStreamContext : public MediaTrack
6473
~MediaStreamContext()
6574
{
6675
aamp_Free(&mDownloadedFragment);
76+
delete pCMCDMetrics;
6777
}
6878

6979
/**
@@ -143,6 +153,7 @@ class MediaStreamContext : public MediaTrack
143153
bool IsAtEndOfTrack();
144154

145155
MediaType mediaType;
156+
CMCDHeaders *pCMCDMetrics;/**<pointer object to class CMCDHeaders*/
146157
struct FragmentDescriptor fragmentDescriptor;
147158
const IAdaptationSet *adaptationSet;
148159
const IRepresentation *representation;

StreamAbstractionAAMP.h

+7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434

3535
#include <glib.h>
3636
#include "subtitleParser.h"
37+
#include <CMCDHeaders.h>
38+
#include <AudioCMCDHeaders.h>
39+
#include <VideoCMCDHeaders.h>
40+
#include <ManifestCMCDHeaders.h>
41+
#include <SubtitleCMCDHeaders.h>
42+
43+
3744

3845
/**
3946
* @brief Media Track Types

fragmentcollector_hls.cpp

+20-5
Original file line numberDiff line numberDiff line change
@@ -1775,7 +1775,7 @@ bool TrackState::FetchFragmentHelper(long &http_error, bool &decryption_error, b
17751775
std::string tempEffectiveUrl;
17761776
AAMPLOG_TRACE(" Calling Getfile . buffer %p avail %d", &cachedFragment->fragment, (int)cachedFragment->fragment.avail);
17771777
bool fetched = aamp->GetFile(fragmentUrl, &cachedFragment->fragment,
1778-
tempEffectiveUrl, &http_error, &downloadTime, range, type, false, (MediaType)(type), NULL, NULL, fragmentDurationSeconds);
1778+
tempEffectiveUrl, &http_error, &downloadTime, range, type, false, (MediaType)(type), NULL, NULL, fragmentDurationSeconds,pCMCDMetrics);
17791779
//Workaround for 404 of subtitle fragments
17801780
//TODO: This needs to be handled at server side and this workaround has to be removed
17811781
if (!fetched && http_error == 404 && type == eTRACK_SUBTITLE)
@@ -4001,7 +4001,7 @@ AAMPStatusType StreamAbstractionAAMP_HLS::Init(TuneType tuneType)
40014001
std::string mainManifestOrigUrl = aamp->GetManifestUrl();
40024002
double downloadTime;
40034003
aamp->SetCurlTimeout(aamp->mManifestTimeoutMs, eCURLINSTANCE_MANIFEST_PLAYLIST);
4004-
(void) aamp->GetFile(aamp->GetManifestUrl(), &this->mainManifest, aamp->GetManifestUrl(), &http_error, &mainManifestdownloadTime, NULL, eCURLINSTANCE_MANIFEST_PLAYLIST, true, eMEDIATYPE_MANIFEST);//CID:82578 - checked return
4004+
(void) aamp->GetFile(aamp->GetManifestUrl(), &this->mainManifest, aamp->GetManifestUrl(), &http_error, &mainManifestdownloadTime, NULL, eCURLINSTANCE_MANIFEST_PLAYLIST, true, eMEDIATYPE_MANIFEST,NULL,NULL,0,pCMCDMetrics);//CID:82578 - checked return
40054005
updateVideoEndMetrics = true;
40064006
aamp->SetCurlTimeout(aamp->mPlaylistTimeoutMs, eCURLINSTANCE_MANIFEST_PLAYLIST);
40074007
if (this->mainManifest.len)
@@ -5637,7 +5637,7 @@ StreamAbstractionAAMP_HLS::StreamAbstractionAAMP_HLS(AampLogManager *logObj, cla
56375637
rate(rate), maxIntervalBtwPlaylistUpdateMs(DEFAULT_INTERVAL_BETWEEN_PLAYLIST_UPDATES_MS), mainManifest(), allowsCache(false), seekPosition(seekpos), mTrickPlayFPS(),
56385638
enableThrottle(false), firstFragmentDecrypted(false), mStartTimestampZero(false), mNumberOfTracks(0), midSeekPtsOffset(0),
56395639
lastSelectedProfileIndex(0), segDLFailCount(0), segDrmDecryptFailCount(0), mMediaCount(0),mProfileCount(0),
5640-
mLangList(),mIframeAvailable(false), thumbnailManifest(), indexedTileInfo(),
5640+
mLangList(),mIframeAvailable(false), thumbnailManifest(), indexedTileInfo(),pCMCDMetrics(NULL),
56415641
mFirstPTS(0)
56425642
{
56435643
#ifndef AVE_DRM
@@ -5659,6 +5659,10 @@ StreamAbstractionAAMP_HLS::StreamAbstractionAAMP_HLS(AampLogManager *logObj, cla
56595659
memset(&trackState[0], 0x00, sizeof(trackState));
56605660
aamp->CurlInit(eCURLINSTANCE_VIDEO, DEFAULT_CURL_INSTANCE_COUNT,aamp->GetNetworkProxy());
56615661
memset(streamInfo, 0, sizeof(*streamInfo));
5662+
if(ISCONFIGSET(eAAMPConfig_EnableCMCD))
5663+
{
5664+
pCMCDMetrics = new ManifestCMCDHeaders();
5665+
}
56625666

56635667
}
56645668

@@ -5687,8 +5691,8 @@ TrackState::TrackState(AampLogManager *logObj, TrackType type, StreamAbstraction
56875691
mPlaylistIndexed(), mDiscoCheckMutex(), mDiscoCheckComplete(), mTrackDrmMutex(), mPlaylistType(ePLAYLISTTYPE_UNDEFINED), mReachedEndListTag(false),
56885692
mByteOffsetCalculation(false),mSkipAbr(false),
56895693
mCheckForInitialFragEnc(false), mFirstEncInitFragmentInfo(NULL), mDrmMethod(eDRM_KEY_METHOD_NONE)
5690-
,mXStartTimeOFfset(0), mCulledSecondsAtStart(0.0)
5691-
,mProgramDateTime(0.0)
5694+
,mXStartTimeOFfset(0), mCulledSecondsAtStart(0.0)//, mCMCDNetworkMetrics{-1,-1,-1}
5695+
,mProgramDateTime(0.0),pCMCDMetrics(NULL)
56925696
,mDiscontinuityCheckingOn(false)
56935697
,mSkipSegmentOnError(true)
56945698
{
@@ -5705,6 +5709,15 @@ TrackState::TrackState(AampLogManager *logObj, TrackType type, StreamAbstraction
57055709
mCulledSecondsAtStart = aamp->culledSeconds;
57065710
mProgramDateTime = aamp->mProgramDateTime;
57075711
AAMPLOG_INFO("Restore PDT (%f) ",mProgramDateTime);
5712+
if(ISCONFIGSET(eAAMPConfig_EnableCMCD))
5713+
{
5714+
if(type == eTRACK_VIDEO)
5715+
pCMCDMetrics = new VideoCMCDHeaders();
5716+
else if(type == eTRACK_AUDIO)
5717+
pCMCDMetrics = new AudioCMCDHeaders();
5718+
else if(type == eTRACK_SUBTITLE)
5719+
pCMCDMetrics = new SubtitleCMCDHeaders();
5720+
}
57085721
}
57095722

57105723

@@ -5738,6 +5751,7 @@ TrackState::~TrackState()
57385751
pthread_cond_destroy(&mPlaylistIndexed);
57395752
pthread_mutex_destroy(&mPlaylistMutex);
57405753
pthread_mutex_destroy(&mTrackDrmMutex);
5754+
delete pCMCDMetrics;
57415755

57425756
}
57435757

@@ -5806,6 +5820,7 @@ StreamAbstractionAAMP_HLS::~StreamAbstractionAAMP_HLS()
58065820
aamp_Free(&this->mainManifest);
58075821
aamp->CurlTerm(eCURLINSTANCE_VIDEO, DEFAULT_CURL_INSTANCE_COUNT);
58085822
aamp->SyncEnd();
5823+
delete pCMCDMetrics;
58095824
}
58105825

58115826
/**

fragmentcollector_hls.h

+2
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ class TrackState : public MediaTrack
523523
KeyHashTable mKeyHashTable;
524524
bool mCheckForInitialFragEnc; /**< Flag that denotes if we should check for encrypted init header and push it to GStreamer*/
525525
DrmKeyMethod mDrmMethod; /**< denotes the X-KEY method for the fragment of interest */
526+
CMCDHeaders *pCMCDMetrics; /**<pointer object to class CMCDHeaders*/
526527

527528
private:
528529
bool refreshPlaylist; /**< bool flag to indicate if playlist refresh required or not */
@@ -793,6 +794,7 @@ class StreamAbstractionAAMP_HLS : public StreamAbstractionAAMP
793794
bool firstFragmentDecrypted; /**< Flag indicating if first fragment is decrypted for stream */
794795
bool mStartTimestampZero; /**< Flag indicating if timestamp to start is zero or not (No audio stream) */
795796
int mNumberOfTracks; /**< Number of media tracks.*/
797+
CMCDHeaders *pCMCDMetrics; /**<pointer object to class CMCDHeaders*/
796798
/***************************************************************************
797799
* @fn ParseMainManifest
798800
*

fragmentcollector_mpd.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ StreamAbstractionAAMP_MPD::StreamAbstractionAAMP_MPD(AampLogManager *logObj, cla
314314
,mHasServerUtcTime(0)
315315
,latencyMonitorThreadStarted(false),prevLatencyStatus(LATENCY_STATUS_UNKNOWN),latencyStatus(LATENCY_STATUS_UNKNOWN),latencyMonitorThreadID(0)
316316
,mStreamLock()
317-
,mProfileCount(0)
317+
,mProfileCount(0),pCMCDMetrics(NULL)
318318
,mLiveTimeFragmentSync(false)
319319
,mSubtitleParser()
320320
{
@@ -387,6 +387,10 @@ StreamAbstractionAAMP_MPD::StreamAbstractionAAMP_MPD(AampLogManager *logObj, cla
387387
}
388388

389389
trickplayMode = (rate != AAMP_NORMAL_PLAY_RATE);
390+
if(ISCONFIGSET(eAAMPConfig_EnableCMCD))
391+
{
392+
pCMCDMetrics = new ManifestCMCDHeaders();
393+
}
390394
}
391395

392396
static void GetBitrateInfoFromCustomMpd( const IAdaptationSet *adaptationSet, std::vector<Representation *>& representations );
@@ -5123,7 +5127,7 @@ AAMPStatusType StreamAbstractionAAMP_MPD::UpdateMPD(bool init)
51235127
memset(&manifest, 0, sizeof(manifest));
51245128
aamp->profiler.ProfileBegin(PROFILE_BUCKET_MANIFEST);
51255129
aamp->SetCurlTimeout(aamp->mManifestTimeoutMs,eCURLINSTANCE_VIDEO);
5126-
gotManifest = aamp->GetFile(manifestUrl, &manifest, manifestUrl, &http_error, &downloadTime, NULL, eCURLINSTANCE_VIDEO, true, eMEDIATYPE_MANIFEST);
5130+
gotManifest = aamp->GetFile(manifestUrl, &manifest, manifestUrl, &http_error, &downloadTime, NULL, eCURLINSTANCE_VIDEO, true, eMEDIATYPE_MANIFEST,NULL,NULL,0,pCMCDMetrics);
51275131
aamp->SetCurlTimeout(aamp->mNetworkTimeoutMs,eCURLINSTANCE_VIDEO);
51285132
//update videoend info
51295133
updateVideoEndMetrics = true;
@@ -9894,6 +9898,7 @@ StreamAbstractionAAMP_MPD::~StreamAbstractionAAMP_MPD()
98949898
memset(aamp->GetLLDashServiceData(),0x00,sizeof(AampLLDashServiceData));
98959899
aamp->SetLowLatencyServiceConfigured(false);
98969900
aamp->SyncEnd();
9901+
delete pCMCDMetrics;
98979902
}
98989903

98999904
/**

fragmentcollector_mpd.h

+1
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ class StreamAbstractionAAMP_MPD : public StreamAbstractionAAMP
792792
bool IsPeriodEncrypted(IPeriod *period);
793793

794794
std::mutex mStreamLock;
795+
CMCDHeaders *pCMCDMetrics;/**<pointer object to class CMCDHeaders*/
795796
bool fragmentCollectorThreadStarted;
796797
std::set<std::string> mLangList;
797798
double seekPosition;

0 commit comments

Comments
 (0)