RDK Documentation (Open Sourced RDK Components)
MediaStreamContext.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's license file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2021 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file MediaStreamContext.cpp
22  * @brief Handles operations on Media streams
23  */
24 
25 #include "MediaStreamContext.h"
26 #include "AampMemoryUtils.h"
27 #include "isobmff/isobmffbuffer.h"
28 #include "AampCacheHandler.h"
29 
30 /**
31  * @brief Receives cached fragment and injects to sink.
32  */
33 void MediaStreamContext::InjectFragmentInternal(CachedFragment* cachedFragment, bool &fragmentDiscarded)
34 {
35  //FN_TRACE_F_MPD( __FUNCTION__ );
38  {
40  AAMPLOG_TRACE("Type[%d] cachedFragment->position: %f cachedFragment->duration: %f cachedFragment->initFragment: %d", type, cachedFragment->position,cachedFragment->duration,cachedFragment->initFragment);
43  }
44  else
45  {
46  AAMPLOG_TRACE("Full Fragment Send Ignored in LL Mode");
47  }
48  fragmentDiscarded = false;
49 } // InjectFragmentInternal
50 
51 
52 /**
53  * @brief Fetch and cache a fragment
54  */
55 bool MediaStreamContext::CacheFragment(std::string fragmentUrl, unsigned int curlInstance, double position, double duration, const char *range, bool initSegment, bool discontinuity
56  , bool playingAd, double pto, uint32_t scale, bool overWriteTrackId)
57 {
58  // FN_TRACE_F_MPD( __FUNCTION__ );
59  bool ret = false;
60  AAMPLOG_TRACE("Type[%d] fragmentUrl %s fragmentTime %f discontinuity %d pto %f scale %u duration %f", type, fragmentUrl.c_str(), position, discontinuity, pto, scale, duration);
61 
62  fragmentDurationSeconds = duration;
63  ProfilerBucketType bucketType = aamp->GetProfilerBucketForMedia(mediaType, initSegment);
65  long bitrate = 0;
66  double downloadTime = 0;
67  MediaType actualType = (MediaType)(initSegment?(eMEDIATYPE_INIT_VIDEO+mediaType):mediaType); //Need to revisit the logic
68 
69  cachedFragment->type = actualType;
70  cachedFragment->initFragment = initSegment;
71 
72  if(!initSegment && mDownloadedFragment.ptr)
73  {
74  ret = true;
75  cachedFragment->fragment.ptr = mDownloadedFragment.ptr;
76  cachedFragment->fragment.len = mDownloadedFragment.len;
77  cachedFragment->fragment.avail = mDownloadedFragment.avail;
78  memset(&mDownloadedFragment, 0, sizeof(GrowableBuffer));
79  }
80  else
81  {
82  std::string effectiveUrl;
83  int iFogError = -1;
84  int iCurrentRate = aamp->rate; // Store it as back up, As sometimes by the time File is downloaded, rate might have changed due to user initiated Trick-Play
85  bool bReadfromcache = false;
86  if(initSegment)
87  {
88  ret = bReadfromcache = aamp->getAampCacheHandler()->RetrieveFromInitFragCache(fragmentUrl,&cachedFragment->fragment,effectiveUrl);
89  }
90 
91  if(!bReadfromcache)
92  {
93  ret = aamp->LoadFragment(pCMCDMetrics,bucketType, fragmentUrl,effectiveUrl, &cachedFragment->fragment, curlInstance,
94  range, actualType, &httpErrorCode, &downloadTime, &bitrate, &iFogError, fragmentDurationSeconds );
95  if ( initSegment && ret )
96  aamp->getAampCacheHandler()->InsertToInitFragCache ( fragmentUrl, &cachedFragment->fragment, effectiveUrl, actualType);
97  }
98 
99  if (iCurrentRate != AAMP_NORMAL_PLAY_RATE)
100  {
101  if(actualType == eMEDIATYPE_VIDEO)
102  {
103  actualType = eMEDIATYPE_IFRAME;
104  }
105  else if(actualType == eMEDIATYPE_INIT_VIDEO)
106  {
107  actualType = eMEDIATYPE_INIT_IFRAME;
108  }
109  //CID:101284 - To resolve the deadcode
110  }
111  else
112  {
113  if(actualType == eMEDIATYPE_INIT_VIDEO || actualType == eMEDIATYPE_INIT_AUDIO)
114  {
115  //To read track_id from the init fragments to check if there any mismatch.
116  //A mismatch in track_id is not handled in the gstreamer version 1.10.4
117  //But is handled in the latest version (1.18.5),
118  //so upon upgrade to it or introduced a patch in qtdemux,
119  //this portion can be reverted
120  IsoBmffBuffer buffer;
121  buffer.setBuffer((uint8_t *)cachedFragment->fragment.ptr, cachedFragment->fragment.len);
122  buffer.parseBuffer();
123  uint32_t track_id = 0;
124  buffer.getTrack_id(track_id);
125 
126 
127  if(actualType == eMEDIATYPE_INIT_VIDEO)
128  {
129  AAMPLOG_INFO("Video track_id read from init fragment: %d ", track_id);
130  bool trackIdUpdated = false;
131  if(aamp->mCurrentVideoTrackId != -1 && track_id != aamp->mCurrentVideoTrackId)
132  {
133  if(overWriteTrackId)
134  {
135  //Overwrite the track id of the init fragment with the existing track id since overWriteTrackId is true only while pushing the encrypted init fragment while clear content is being played
136  buffer.parseBuffer(false, aamp->mCurrentVideoTrackId);
137  AAMPLOG_WARN("Video track_id of the current track is overwritten as init fragment is pushing only for DRM purpose, track id: %d ", track_id);
138  trackIdUpdated = true;
139  }
140  else
141  {
142  aamp->mIsTrackIdMismatch = true;
143  AAMPLOG_WARN("TrackId mismatch detected for video, current track_id: %d, next period track_id: %d", aamp->mCurrentVideoTrackId, track_id);
144  }
145  }
146  if(!trackIdUpdated)
147  {
148  aamp->mCurrentVideoTrackId = track_id;
149  }
150 
151  }
152  else
153  {
154  bool trackIdUpdated = false;
155  AAMPLOG_INFO("Audio track_id read from init fragment: %d ", track_id);
156  if(aamp->mCurrentAudioTrackId != -1 && track_id != aamp->mCurrentAudioTrackId)
157  {
158  if(overWriteTrackId)
159  {
160  buffer.parseBuffer(false, aamp->mCurrentAudioTrackId);
161  AAMPLOG_WARN("Audio track_id of the current track is overwritten as init fragment is pushing only for DRM purpose, track id: %d ", track_id);
162  trackIdUpdated = true;
163  }
164  else
165  {
166  aamp->mIsTrackIdMismatch = true;
167  AAMPLOG_WARN("TrackId mismatch detected for audio, current track_id: %d, next period track_id: %d", aamp->mCurrentAudioTrackId, track_id);
168  }
169  }
170  if(!trackIdUpdated)
171  {
172  aamp->mCurrentAudioTrackId = track_id;
173  }
174  }
175  }
176  }
177 
178  if(!bReadfromcache)
179  {
180  //update videoend info
181  aamp->UpdateVideoEndMetrics( actualType,
182  bitrate? bitrate : fragmentDescriptor.Bandwidth,
183  (iFogError > 0 ? iFogError : httpErrorCode),effectiveUrl,duration, downloadTime);
184  }
185  }
186 
187  context->mCheckForRampdown = false;
188  if(bitrate > 0 && bitrate != fragmentDescriptor.Bandwidth)
189  {
190  AAMPLOG_INFO("Bitrate changed from %u to %ld",fragmentDescriptor.Bandwidth, bitrate);
191  fragmentDescriptor.Bandwidth = bitrate;
192  context->SetTsbBandwidth(bitrate);
193  mDownloadedFragment.ptr = cachedFragment->fragment.ptr;
194  mDownloadedFragment.avail = cachedFragment->fragment.avail;
195  mDownloadedFragment.len = cachedFragment->fragment.len;
196  memset(&cachedFragment->fragment, 0, sizeof(GrowableBuffer));
197  ret = false;
198  }
199  else if (!ret)
200  {
201  AAMPLOG_INFO("fragment fetch failed - Free cachedFragment");
203  if( aamp->DownloadsAreEnabled())
204  {
205  AAMPLOG_WARN("%sfragment fetch failed -- fragmentUrl %s", (initSegment)?"Init ":" ", fragmentUrl.c_str());
206  if (mSkipSegmentOnError)
207  {
208  // Skip segment on error, and increse fail count
209  segDLFailCount += 1;
210  }
211  else
212  {
213  // Rampdown already attempted on same segment
214  // Reset flag for next fetch
215  mSkipSegmentOnError = true;
216  }
217  int FragmentDownloadFailThreshold;
218  GETCONFIGVALUE(eAAMPConfig_FragmentDownloadFailThreshold,FragmentDownloadFailThreshold);
219  if (FragmentDownloadFailThreshold <= segDLFailCount)
220  {
221  if(!playingAd) //If playingAd, we are invalidating the current Ad in onAdEvent().
222  {
223  if (!initSegment)
224  {
225  AAMPLOG_ERR("Not able to download fragments; reached failure threshold sending tune failed event");
227  }
228  else
229  {
230  // When rampdown limit is not specified, init segment will be ramped down, this wil
231  AAMPLOG_ERR("Not able to download init fragments; reached failure threshold sending tune failed event");
233  }
234  }
235  }
236  // DELIA-32287 - Profile RampDown check and rampdown is needed only for Video . If audio fragment download fails
237  // should continue with next fragment,no retry needed .
238  else if ((eTRACK_VIDEO == type) && !(context->CheckForRampDownLimitReached()))
239  {
240  // Attempt rampdown
241  if (context->CheckForRampDownProfile(httpErrorCode))
242  {
243  context->mCheckForRampdown = true;
244  if (!initSegment)
245  {
246  // Rampdown attempt success, download same segment from lower profile.
247  mSkipSegmentOnError = false;
248  }
249  AAMPLOG_WARN( "StreamAbstractionAAMP_MPD::Error while fetching fragment:%s, failedCount:%d. decrementing profile",
250  fragmentUrl.c_str(), segDLFailCount);
251  }
252  else
253  {
254  if(!playingAd && initSegment)
255  {
256  // Already at lowest profile, send error event for init fragment.
257  AAMPLOG_ERR("Not able to download init fragments; reached failure threshold sending tune failed event");
259  }
260  else
261  {
262  AAMPLOG_WARN("StreamAbstractionAAMP_MPD::Already at the lowest profile, skipping segment");
263  context->mRampDownCount = 0;
264  }
265  }
266  }
267  else if (AAMP_IS_LOG_WORTHY_ERROR(httpErrorCode))
268  {
269  AAMPLOG_WARN("StreamAbstractionAAMP_MPD::Error on fetching %s fragment. failedCount:%d",
271  // For init fragment, rampdown limit is reached. Send error event.
272  if(!playingAd && initSegment)
273  {
275  }
276  }
277  }
278  }
279  else
280  {
281  cachedFragment->position = position;
282  cachedFragment->duration = duration;
283  cachedFragment->discontinuity = discontinuity;
284 #ifdef AAMP_DEBUG_INJECT
285  if (discontinuity)
286  {
287  AAMPLOG_WARN("Discontinuous fragment");
288  }
289  if ((1 << type) & AAMP_DEBUG_INJECT)
290  {
291  cachedFragment->uri.assign(fragmentUrl);
292  }
293 #endif
294  segDLFailCount = 0;
295  if ((eTRACK_VIDEO == type) && (!initSegment))
296  {
297  // reset count on video fragment success
298  context->mRampDownCount = 0;
299  }
301  ret = true;
302  }
303  return ret;
304 }
305 
306 /**
307  * @brief Cache Fragment Chunk
308  */
309 bool MediaStreamContext::CacheFragmentChunk(MediaType actualType, char *ptr, size_t size, std::string remoteUrl,long long dnldStartTime)
310 {
311  AAMPLOG_TRACE("[%s] Chunk Buffer Length %zu Remote URL %s", name, size, remoteUrl.c_str());
312 
313  bool ret = true;
315  {
316  CachedFragmentChunk* cachedFragmentChunk = NULL;
317  cachedFragmentChunk = GetFetchChunkBuffer(true);
318  if(NULL == cachedFragmentChunk)
319  {
320  AAMPLOG_WARN("[%s] Something Went wrong - Can't get FetchChunkBuffer", name);
321  return false;
322  }
323  cachedFragmentChunk->type = actualType;
324  cachedFragmentChunk->downloadStartTime = dnldStartTime;
325  aamp_AppendBytes(&cachedFragmentChunk->fragmentChunk, ptr, size);
326 
327  AAMPLOG_TRACE("[%s] cachedFragmentChunk %p ptr %p",name, cachedFragmentChunk, cachedFragmentChunk->fragmentChunk.ptr);
328 
330  }
331  else
332  {
333  AAMPLOG_WARN("[%s] WaitForCachedFragmentChunkInjected aborted", name);
334  ret = false;
335  }
336  return ret;
337 }
338 
339 
340 /**
341  * @brief Listener to ABR profile change
342  */
344 {
346  // Get AdaptationSet Index and Representation Index from the corresponding profile
347  int adaptIdxFromProfile = profileMap.adaptationSetIndex;
348  int reprIdxFromProfile = profileMap.representationIndex;
349  if (!((adaptationSetIdx == adaptIdxFromProfile) && (representationIndex == reprIdxFromProfile)))
350  {
351  const IAdaptationSet *pNewAdaptationSet = context->GetAdaptationSetAtIndex(adaptIdxFromProfile);
352  IRepresentation *pNewRepresentation = pNewAdaptationSet->GetRepresentation().at(reprIdxFromProfile);
353  if(representation != NULL)
354  {
355  AAMPLOG_WARN("StreamAbstractionAAMP_MPD: ABR %dx%d[%d] -> %dx%d[%d]",
356  representation->GetWidth(), representation->GetHeight(), representation->GetBandwidth(),
357  pNewRepresentation->GetWidth(), pNewRepresentation->GetHeight(), pNewRepresentation->GetBandwidth());
358  adaptationSetIdx = adaptIdxFromProfile;
359  adaptationSet = pNewAdaptationSet;
360  adaptationSetId = adaptationSet->GetId();
361  representationIndex = reprIdxFromProfile;
362  representation = pNewRepresentation;
363 
364  dash::mpd::IMPD *mpd = context->GetMPD();
365  IPeriod *period = context->GetPeriod();
366  fragmentDescriptor.ClearMatchingBaseUrl();
367  fragmentDescriptor.AppendMatchingBaseUrl( &mpd->GetBaseUrls() );
368  fragmentDescriptor.AppendMatchingBaseUrl( &period->GetBaseURLs() );
369  fragmentDescriptor.AppendMatchingBaseUrl( &adaptationSet->GetBaseURLs() );
370  fragmentDescriptor.AppendMatchingBaseUrl( &representation->GetBaseURLs() );
371 
372  fragmentDescriptor.Bandwidth = representation->GetBandwidth();
373  fragmentDescriptor.RepresentationID.assign(representation->GetId());
374  profileChanged = true;
375  }
376  else
377  {
378  AAMPLOG_WARN("representation is null"); //CID:83962 - Null Returns
379  }
380  }
381  else
382  {
383  AAMPLOG_TRACE("StreamAbstractionAAMP_MPD:: Not switching ABR %dx%d[%d] ",
384  representation->GetWidth(), representation->GetHeight(), representation->GetBandwidth());
385  }
386 
387 }
388 
389 /**
390  * @brief Get duration of buffer
391  */
393 {
394  double position = aamp->GetPositionMs() / 1000.00;
395  if(downloadedDuration >= position)
396  {
397  // If player faces buffering, this will be 0
398  return (downloadedDuration - position);
399  }
400  else
401  {
402  // This avoids negative buffer, expecting
403  // downloadedDuration never exceeds position in normal case.
404  // Other case happens when contents are yet to be injected.
405  downloadedDuration = 0;
406  return downloadedDuration;
407  }
408 }
409 
410 /**
411  * @brief Notify discontinuity during trick-mode as PTS re-stamping is done in sink
412  */
414 {
415  // FN_TRACE_F_MPD( __FUNCTION__ );
417 }
418 
419 /**
420  * @brief Returns if the end of track reached.
421  */
423 {
424  // FN_TRACE_F_MPD( __FUNCTION__ );
425  return eosReached;
426 }
427 
428 
aamp_Free
void aamp_Free(void *ptr)
wrapper for g_free, used for segment allocation
Definition: AampMemoryUtils.cpp:56
CachedFragmentChunk::fragmentChunk
GrowableBuffer fragmentChunk
Definition: StreamAbstractionAAMP.h:120
PrivateInstanceAAMP::SignalTrickModeDiscontinuity
void SignalTrickModeDiscontinuity()
Signal trick mode discontinuity to stream sink.
Definition: priv_aamp.cpp:9100
StreamAbstractionAAMP_MPD::GetAdaptationSetAndRepresetationIndicesForProfile
struct ProfileInfo GetAdaptationSetAndRepresetationIndicesForProfile(int profileIndex)
Get Adaptation Set and Representation Index for given profile.
Definition: fragmentcollector_mpd.cpp:6234
CachedFragmentChunk::downloadStartTime
long long downloadStartTime
Definition: StreamAbstractionAAMP.h:122
eTRACK_VIDEO
@ eTRACK_VIDEO
Definition: StreamAbstractionAAMP.h:50
ProfileInfo
Manifest file adaptation and representation info.
Definition: fragmentcollector_mpd.h:79
MediaTrack::eosReached
bool eosReached
Definition: StreamAbstractionAAMP.h:514
eMEDIATYPE_INIT_IFRAME
@ eMEDIATYPE_INIT_IFRAME
Definition: AampMediaType.h:55
MediaTrack::fragmentDurationSeconds
double fragmentDurationSeconds
Definition: StreamAbstractionAAMP.h:519
PrivateInstanceAAMP::SendDownloadErrorEvent
void SendDownloadErrorEvent(AAMPTuneFailure tuneFailure, long error_code)
Handles download errors and sends events to application if required.
Definition: priv_aamp.cpp:2330
CachedFragment::initFragment
bool initFragment
Definition: StreamAbstractionAAMP.h:104
eMEDIATYPE_VIDEO
@ eMEDIATYPE_VIDEO
Definition: AampMediaType.h:39
MediaTrack::WaitForCachedFragmentChunkInjected
bool WaitForCachedFragmentChunkInjected(int timeoutMs=-1)
Wait until a cached fragment chunk is Injected.
Definition: streamabstraction.cpp:490
CachedFragment::duration
double duration
Definition: StreamAbstractionAAMP.h:103
MediaTrack::cachedFragment
CachedFragment * cachedFragment
Definition: StreamAbstractionAAMP.h:535
CachedFragmentChunk::type
MediaType type
Definition: StreamAbstractionAAMP.h:121
AampLLDashServiceData::lowLatencyMode
bool lowLatencyMode
Definition: priv_aamp.h:512
AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE
@ AAMP_TUNE_INIT_FRAGMENT_DOWNLOAD_FAILURE
Definition: AampEvent.h:120
StreamAbstractionAAMP::SetTsbBandwidth
void SetTsbBandwidth(long tsbBandwidth)
When TSB is involved, use this to set bandwidth to be reported.
Definition: StreamAbstractionAAMP.h:692
MediaTrack::segDLFailCount
int segDLFailCount
Definition: StreamAbstractionAAMP.h:520
PrivateInstanceAAMP::mCurrentVideoTrackId
int mCurrentVideoTrackId
Definition: priv_aamp.h:1029
GrowableBuffer::avail
size_t avail
Definition: AampMemoryUtils.h:43
MediaStreamContext::CacheFragment
bool CacheFragment(std::string fragmentUrl, unsigned int curlInstance, double position, double duration, const char *range=NULL, bool initSegment=false, bool discontinuity=false, bool playingAd=false, double pto=0, uint32_t scale=0, bool overWriteTrackId=false)
Fetch and cache a fragment.
Definition: MediaStreamContext.cpp:55
GrowableBuffer::len
size_t len
Definition: AampMemoryUtils.h:42
PrivateInstanceAAMP::getAampCacheHandler
AampCacheHandler * getAampCacheHandler()
Get AampCacheHandler instance.
Definition: priv_aamp.cpp:6277
MediaTrack::type
TrackType type
Definition: StreamAbstractionAAMP.h:523
PrivateInstanceAAMP::ProcessID3Metadata
void ProcessID3Metadata(char *segment, size_t size, MediaType type, uint64_t timestampOffset=0)
Process the ID3 metadata from segment.
Definition: priv_aamp.cpp:11501
PrivateInstanceAAMP::UpdateVideoEndMetrics
void UpdateVideoEndMetrics(MediaType mediaType, long bitrate, int curlOrHTTPCode, std::string &strUrl, double curlDownloadTime, ManifestData *manifestData=NULL)
updates download metrics to VideoStat object, this is used for VideoFragment as it takes duration for...
Definition: priv_aamp.cpp:8180
PrivateInstanceAAMP::SendStreamTransfer
void SendStreamTransfer(MediaType mediaType, GrowableBuffer *buffer, double fpts, double fdts, double fDuration, bool initFragment=0)
API to send audio/video stream into the sink.
Definition: priv_aamp.cpp:7018
CachedFragmentChunk
Structure of cached fragment data Holds information about a cached fragment.
Definition: StreamAbstractionAAMP.h:118
MediaStreamContext::CacheFragmentChunk
bool CacheFragmentChunk(MediaType actualType, char *ptr, size_t size, std::string remoteUrl, long long dnldStartTime)
Cache Fragment Chunk.
Definition: MediaStreamContext.cpp:309
CachedFragment::discontinuity
bool discontinuity
Definition: StreamAbstractionAAMP.h:105
StreamAbstractionAAMP::mRampDownCount
int mRampDownCount
Definition: StreamAbstractionAAMP.h:930
MediaStreamContext.h
Handles operations for Media stream context.
PrivateInstanceAAMP::mIsTrackIdMismatch
bool mIsTrackIdMismatch
Definition: priv_aamp.h:1030
eAAMPConfig_FragmentDownloadFailThreshold
@ eAAMPConfig_FragmentDownloadFailThreshold
Definition: AampConfig.h:260
MediaStreamContext::ABRProfileChanged
void ABRProfileChanged(void)
Listener to ABR profile change.
Definition: MediaStreamContext.cpp:343
AampCacheHandler::RetrieveFromInitFragCache
bool RetrieveFromInitFragCache(const std::string url, GrowableBuffer *buffer, std::string &effectiveUrl)
Retrieve init fragment from cache.
Definition: AampCacheHandler.cpp:506
MediaTrack::GetFetchBuffer
CachedFragment * GetFetchBuffer(bool initialize)
Get buffer to store the downloaded fragment content to cache next fragment.
Definition: streamabstraction.cpp:1316
MediaTrack::UpdateTSAfterChunkFetch
void UpdateTSAfterChunkFetch()
Updates internal state after a fragment fetch.
Definition: streamabstraction.cpp:324
StreamAbstractionAAMP::CheckForRampDownProfile
bool CheckForRampDownProfile(long http_error)
Check for ramdown profile.
Definition: streamabstraction.cpp:2143
eMEDIATYPE_AUDIO
@ eMEDIATYPE_AUDIO
Definition: AampMediaType.h:40
AampMemoryUtils.h
Header file of helper functions for memory management.
eMEDIATYPE_INIT_AUDIO
@ eMEDIATYPE_INIT_AUDIO
Definition: AampMediaType.h:47
CachedFragment::position
double position
Definition: StreamAbstractionAAMP.h:102
MediaStreamContext::SignalTrickModeDiscontinuity
void SignalTrickModeDiscontinuity()
Notify discontinuity during trick-mode as PTS re-stamping is done in sink.
Definition: MediaStreamContext.cpp:413
AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE
@ AAMP_TUNE_FRAGMENT_DOWNLOAD_FAILURE
Definition: AampEvent.h:119
MediaType
MediaType
Media types.
Definition: AampMediaType.h:37
IsoBmffBuffer
Class for ISO BMFF Buffer.
Definition: isobmffbuffer.h:39
GrowableBuffer::ptr
char * ptr
Definition: AampMemoryUtils.h:41
MediaTrack::name
const char * name
Definition: StreamAbstractionAAMP.h:518
MediaStreamContext::pCMCDMetrics
CMCDHeaders * pCMCDMetrics
Definition: MediaStreamContext.h:156
AampCacheHandler::InsertToInitFragCache
void InsertToInitFragCache(const std::string url, const GrowableBuffer *buffer, std::string effectiveUrl, MediaType fileType)
Insert init fragment into cache table.
Definition: AampCacheHandler.cpp:423
StreamAbstractionAAMP::CheckForRampDownLimitReached
bool CheckForRampDownLimitReached()
Check for ramp down limit reached by player.
Definition: streamabstraction.cpp:2943
eMEDIATYPE_IFRAME
@ eMEDIATYPE_IFRAME
Definition: AampMediaType.h:45
AampCacheHandler.h
Cache handler for AAMP.
StreamAbstractionAAMP::mCheckForRampdown
bool mCheckForRampdown
Definition: StreamAbstractionAAMP.h:928
PrivateInstanceAAMP::GetPositionMs
long long GetPositionMs(void)
Get current stream position.
Definition: priv_aamp.cpp:6842
AAMPLOG_TRACE
#define AAMPLOG_TRACE(FORMAT,...)
AAMP logging defines, this can be enabled through setLogLevel() as per the need.
Definition: AampLogManager.h:83
StreamAbstractionAAMP_MPD::GetAdaptationSetAtIndex
const IAdaptationSet * GetAdaptationSetAtIndex(int idx)
Get Adaptation Set at given index for the current period.
Definition: fragmentcollector_mpd.cpp:6222
isobmffbuffer.h
Header file for ISO Base Media File Format Buffer.
GrowableBuffer
Structure of GrowableBuffer.
Definition: AampMemoryUtils.h:39
MediaStreamContext::InjectFragmentInternal
void InjectFragmentInternal(CachedFragment *cachedFragment, bool &fragmentDiscarded)
Receives cached fragment and injects to sink.
Definition: MediaStreamContext.cpp:33
ProfilerBucketType
ProfilerBucketType
Bucket types of AAMP profiler.
Definition: AampProfiler.h:43
eMEDIATYPE_INIT_VIDEO
@ eMEDIATYPE_INIT_VIDEO
Definition: AampMediaType.h:46
aamp_AppendBytes
void aamp_AppendBytes(struct GrowableBuffer *buffer, const void *ptr, size_t len)
append data to GrowableBuffer ADT
Definition: AampMemoryUtils.cpp:108
MediaStreamContext::IsAtEndOfTrack
bool IsAtEndOfTrack()
Returns if the end of track reached.
Definition: MediaStreamContext.cpp:422
PrivateInstanceAAMP::DownloadsAreEnabled
bool DownloadsAreEnabled(void)
Check if downloads are enabled.
Definition: priv_aamp.cpp:6752
StreamAbstractionAAMP::currentProfileIndex
int currentProfileIndex
Definition: StreamAbstractionAAMP.h:918
MediaTrack::aamp
PrivateInstanceAAMP * aamp
Definition: StreamAbstractionAAMP.h:534
PrivateInstanceAAMP::mCurrentAudioTrackId
int mCurrentAudioTrackId
Definition: priv_aamp.h:1028
CachedFragment
Structure of cached fragment data Holds information about a cached fragment.
Definition: StreamAbstractionAAMP.h:99
CachedFragment::fragment
GrowableBuffer fragment
Definition: StreamAbstractionAAMP.h:101
PrivateInstanceAAMP::GetLLDashServiceData
AampLLDashServiceData * GetLLDashServiceData(void)
Gets Low Latency Service Data.
Definition: priv_aamp.cpp:11587
CachedFragment::type
MediaType type
Definition: StreamAbstractionAAMP.h:111
MediaStreamContext::GetBufferedDuration
double GetBufferedDuration()
Get duration of buffer.
Definition: MediaStreamContext.cpp:392
MediaTrack::UpdateTSAfterFetch
void UpdateTSAfterFetch()
Updates internal state after a fragment fetch.
Definition: streamabstraction.cpp:248
MediaTrack::GetFetchChunkBuffer
CachedFragmentChunk * GetFetchChunkBuffer(bool initialize)
Get buffer to fetch and cache next fragment chunk.
Definition: streamabstraction.cpp:1334
PrivateInstanceAAMP::rate
float rate
Definition: priv_aamp.h:955
PrivateInstanceAAMP::LoadFragment
char * LoadFragment(ProfilerBucketType bucketType, std::string fragmentUrl, std::string &effectiveUrl, size_t *len, unsigned int curlInstance=0, const char *range=NULL, long *http_code=NULL, double *downloadTime=NULL, MediaType fileType=eMEDIATYPE_MANIFEST, int *fogError=NULL)
Fetch a file from CDN and update profiler.
Definition: priv_aamp.cpp:6345
PrivateInstanceAAMP::GetProfilerBucketForMedia
ProfilerBucketType GetProfilerBucketForMedia(MediaType mediaType, bool isInitializationSegment)
Get profiler bucket type.
Definition: priv_aamp.h:670