![]() |
RDK Documentation (Open Sourced RDK Components)
|
State Machine for each Media Track. More...
#include <fragmentcollector_hls.h>


Public Types | |
| typedef std::vector< KeyTagStruct > | KeyHashTable |
| typedef std::vector< KeyTagStruct >::iterator | KeyHashTableIter |
Public Member Functions | |
| TrackState (AampLogManager *logObj, TrackType type, class StreamAbstractionAAMP_HLS *parent, PrivateInstanceAAMP *aamp, const char *name) | |
| TrackState Constructor. | |
| TrackState (const TrackState &)=delete | |
| ~TrackState () | |
| Destructor function. | |
| TrackState & | operator= (const TrackState &)=delete |
| void | Start () |
| Function to create threads for track donwload. | |
| void | Stop (bool clearDRM=false) |
| Function to stop track download/playback. | |
| void | RunFetchLoop () |
| Fragment collector thread execution function to download fragments. | |
| void | IndexPlaylist (bool IsRefresh, double &culledSec) |
| Function to to handle parse and indexing of individual tracks. | |
| void | ABRProfileChanged (void) |
| Function to handle Profile change after ABR. | |
| char * | GetNextFragmentUriFromPlaylist (bool ignoreDiscontinuity=false) |
| Function to get next fragment URI from playlist based on playtarget. | |
| void | UpdateDrmIV (const char *ptr) |
| Function to update IV from DRM. | |
| void | UpdateDrmCMSha1Hash (const char *ptr) |
| Function to Update SHA1 Id for DRM Metadata. | |
| DrmReturn | DrmDecrypt (CachedFragment *cachedFragment, ProfilerBucketType bucketType) |
| Function to decrypt the fragment for playback. | |
| bool | CreateInitVectorByMediaSeqNo (unsigned int ui32Seqno) |
| Function to create init vector using current media sequence number. | |
| void | FetchPlaylist () |
| Function to fetch playlist file. | |
| void | GetNextFragmentPeriodInfo (int &periodIdx, double &offsetFromPeriodStart, int &fragmentIdx) |
| Function to get next playback position from start, to handle discontinuity. | |
| double | GetPeriodStartPosition (int periodIdx) |
| Function to get Period start position for given period index,to handle discontinuity. | |
| int | GetNumberOfPeriods () |
| Function to return number of periods stored in playlist. | |
| bool | HasDiscontinuityAroundPosition (double position, bool useStartTime, double &diffBetweenDiscontinuities, double playPosition, double inputCulledSec, double inputProgramDateTime, bool &isDiffChkReq) |
| Check if discontinuity present around given position. | |
| void | StartInjection () |
| Function to start fragment injection. | |
| void | StopInjection (void) |
| Stop fragment injection. More... | |
| void | StopWaitForPlaylistRefresh () |
| Stop wait for playlist refresh. | |
| void | CancelDrmOperation (bool clearDRM) |
| Cancel all DRM operations. | |
| void | StopDiscontinuityCheckWait () |
| Stop the wait for discontinuity check in each track. | |
| void | RestoreDrmState () |
| Restore DRM states. | |
| bool | IsLive () |
| void | FindTimedMetadata (bool reportbulk=false, bool bInitCall=false) |
| Function to search playlist for subscribed tags. | |
| void | SetXStartTimeOffset (double offset) |
| double | GetXStartTimeOffset () |
| double | GetBufferedDuration () |
| Function to retune buffered duration. | |
Public Member Functions inherited from MediaTrack | |
| MediaTrack (AampLogManager *logObj, TrackType type, PrivateInstanceAAMP *aamp, const char *name) | |
| MediaTrack Constructor. | |
| virtual | ~MediaTrack () |
| MediaTrack Destructor. | |
| MediaTrack (const MediaTrack &)=delete | |
| MediaTrack Copy Constructor. | |
| MediaTrack & | operator= (const MediaTrack &)=delete |
| MediaTrack assignment operator overloading. | |
| void | StartInjectLoop () |
| Start fragment injector loop. More... | |
| void | StartInjectChunkLoop () |
| Start fragment Chunk injector loop. More... | |
| void | StopInjectLoop () |
| Stop fragment injector loop. More... | |
| void | StopInjectChunkLoop () |
| Stop fragment chunk injector loop of track. More... | |
| bool | Enabled () |
| Check if a track is enabled. More... | |
| bool | InjectFragment () |
| Inject fragment into the gstreamer. More... | |
| bool | ProcessFragmentChunk () |
| Process next cached fragment chunk. | |
| bool | InjectFragmentChunk () |
| Inject fragment Chunk into the gstreamer. More... | |
| double | GetTotalInjectedDuration () |
| Get total fragment injected duration. More... | |
| double | GetTotalInjectedChunkDuration () |
| Get total fragment chunk injected duration. More... | |
| void | RunInjectLoop () |
| Injection loop - use internally by injection logic. More... | |
| void | RunInjectChunkLoop () |
| Run fragment injector loop. Injection loop - use internally by injection logic. More... | |
| void | UpdateTSAfterFetch () |
| Updates internal state after a fragment fetch. More... | |
| void | UpdateTSAfterChunkFetch () |
| Updates internal state after a fragment fetch. More... | |
| bool | WaitForFreeFragmentAvailable (int timeoutMs=-1) |
| Wait until a free fragment is available. More... | |
| void | AbortWaitForCachedAndFreeFragment (bool immediate) |
| Abort the waiting for cached fragments and free fragment slot. More... | |
| int | GetTotalFragmentsFetched () |
| Get number of fragments dpownloaded. More... | |
| CachedFragment * | GetFetchBuffer (bool initialize) |
| Get buffer to store the downloaded fragment content to cache next fragment. More... | |
| CachedFragmentChunk * | GetFetchChunkBuffer (bool initialize) |
| Get buffer to fetch and cache next fragment chunk. More... | |
| void | SetCurrentBandWidth (int bandwidthBps) |
| Set current bandwidth of track. More... | |
| int | GetProfileIndexForBW (long mTsbBandwidth) |
| Get profile index for TsbBandwidth. More... | |
| int | GetCurrentBandWidth () |
| Get current bandwidth in bps. More... | |
| double | GetTotalFetchedDuration () |
| Get total duration of fetched fragments. More... | |
| double | GetTotalInjectedChunksDuration () |
| Get total duration of fetched fragments. More... | |
| bool | IsDiscontinuityProcessed () |
| Check if discontinuity is being processed. More... | |
| bool | isFragmentInjectorThreadStarted () |
| void | MonitorBufferHealth () |
| void | ScheduleBufferHealthMonitor () |
| BufferHealthStatus | GetBufferStatus () |
| Get buffer Status of track. More... | |
| BufferHealthStatus | GetBufferHealthStatus () |
| Get buffer health status. More... | |
| void | AbortWaitForCachedFragment () |
| Abort the waiting for cached fragments immediately. More... | |
| bool | IsInjectionAborted () |
| Check whether track data injection is aborted. More... | |
| virtual bool | IsAtEndOfTrack () |
| Returns if the end of track reached. | |
| bool | CheckForFutureDiscontinuity (double &cacheDuration) |
| To check for discontinuity in future fragments. More... | |
| void | OnSinkBufferFull () |
| Called if sink buffer is full. More... | |
| void | FlushFragments () |
| Flushes all cached fragments Flushes all media fragments and resets all relevant counters Only intended for use on subtitle streams. More... | |
| void | FlushFragmentChunks () |
| Flushes all cached fragment Chunks. More... | |
Private Member Functions | |
| char * | GetFragmentUriFromIndex (bool &bSegmentRepeated) |
| Function to get fragment URI from index count. | |
| void | FlushIndex () |
| Function to flush all stored data before refresh and stop. | |
| void | FetchFragment () |
| Function to Fetch the fragment and inject for playback. | |
| bool | FetchFragmentHelper (long &http_error, bool &decryption_error, bool &bKeyChanged, int *fogError, double &downloadTime) |
| Helper function to download fragment. | |
| void | RefreshPlaylist (void) |
| Function to redownload playlist after refresh interval . | |
| StreamAbstractionAAMP * | GetContext () |
| Function to get current StreamAbstractionAAMP instance value. | |
| void | InjectFragmentInternal (CachedFragment *cachedFragment, bool &fragmentDiscarded) |
| Injected decrypted fragment for playback. | |
| char * | FindMediaForSequenceNumber () |
| Get fragment tag based on media sequence number Function to find the media sequence after refresh for continuity. | |
| void | FetchInitFragment () |
| Function to fetch init fragment. | |
| bool | FetchInitFragmentHelper (long &http_code, bool forcePushEncryptedHeader=false) |
| Helper to fetch init fragment for fragmented mp4 format. | |
| void | ProcessDrmMetadata () |
| void | ComputeDeferredKeyRequestTime () |
| void | InitiateDRMKeyAcquisition (int indexPosn=-1) |
| void | SetDrmContext () |
| Function to set DRM Context when KeyTag changes. | |
| void | SwitchSubtitleTrack () |
| Flushes out all old segments and sets up new playlist Used to switch subtitle tracks without restarting the pipeline. | |
Private Attributes | |
| bool | refreshPlaylist |
| pthread_t | fragmentCollectorThreadID |
| bool | fragmentCollectorThreadStarted |
| int | manifestDLFailCount |
| bool | firstIndexDone |
| std::shared_ptr< HlsDrmBase > | mDrm |
| bool | mDrmLicenseRequestPending |
| bool | mInjectInitFragment |
| const char * | mInitFragmentInfo |
| bool | mForceProcessDrmMetadata |
| pthread_mutex_t | mPlaylistMutex |
| pthread_cond_t | mPlaylistIndexed |
| pthread_mutex_t | mTrackDrmMutex |
| pthread_mutex_t | mDiscoCheckMutex |
| pthread_cond_t | mDiscoCheckComplete |
| double | mLastMatchedDiscontPosition |
| double | mCulledSeconds |
| double | mCulledSecondsOld |
| bool | mSyncAfterDiscontinuityInProgress |
| PlaylistType | mPlaylistType |
| bool | mReachedEndListTag |
| bool | mByteOffsetCalculation |
| bool | mSkipAbr |
| const char * | mFirstEncInitFragmentInfo |
| double | mXStartTimeOFfset |
| double | mCulledSecondsAtStart |
| bool | mSkipSegmentOnError |
Additional Inherited Members | |
Protected Member Functions inherited from MediaTrack | |
| void | UpdateTSAfterInject () |
| Update segment cache and inject buffer to gstreamer. More... | |
| void | UpdateTSAfterChunkInject () |
| Update segment cache and inject buffer to gstreamer. More... | |
| bool | WaitForCachedFragmentAvailable () |
| Wait till cached fragment available. More... | |
| bool | WaitForCachedFragmentChunkInjected (int timeoutMs=-1) |
| Wait until a cached fragment chunk is Injected. More... | |
| bool | WaitForCachedFragmentChunkAvailable () |
| Wait till cached fragment chunk available. More... | |
| void | InjectFragmentChunkInternal (MediaType mediaType, GrowableBuffer *buffer, double fpts, double fdts, double fDuration) |
| To be implemented by derived classes to receive cached fragment Chunk Receives cached fragment and injects to sink. More... | |
| virtual void | SignalTrickModeDiscontinuity () |
| To be implemented by derived classes if discontinuity on trick-play is to be notified. More... | |
Static Protected Member Functions inherited from MediaTrack | |
| static int | GetDeferTimeMs (long maxTimeSeconds) |
Protected Attributes inherited from MediaTrack | |
| AampLogManager * | mLogObj |
| PrivateInstanceAAMP * | aamp |
| CachedFragment * | cachedFragment |
| CachedFragmentChunk | cachedFragmentChunks [20] |
| GrowableBuffer | unparsedBufferChunk |
| GrowableBuffer | parsedBufferChunk |
| bool | abort |
| pthread_mutex_t | mutex |
| bool | ptsError |
| bool | abortInject |
| bool | abortInjectChunk |
State Machine for each Media Track.
This class is meant to handle each media track of stream
Definition at line 176 of file fragmentcollector_hls.h.
| typedef std::vector<KeyTagStruct> TrackState::KeyHashTable |
Duration of the track
Definition at line 520 of file fragmentcollector_hls.h.
| TrackState::StopInjection | ( | void | ) |
| std::string TrackState::mEffectiveUrl |
uri associated with downloaded playlist (takes into account 302 redirect)
Definition at line 476 of file fragmentcollector_hls.h.
| std::string TrackState::mPlaylistUrl |
uri associated with downloaded playlist
Definition at line 477 of file fragmentcollector_hls.h.
| GrowableBuffer TrackState::playlist |
downloaded playlist contents
Definition at line 478 of file fragmentcollector_hls.h.
| GrowableBuffer TrackState::index |
packed IndexNode records for associated playlist
Definition at line 481 of file fragmentcollector_hls.h.
| int TrackState::indexCount |
number of indexed fragments in currently indexed playlist
Definition at line 482 of file fragmentcollector_hls.h.
| int TrackState::currentIdx |
index for currently-presenting fragment used during FF/REW (-1 if undefined)
Definition at line 483 of file fragmentcollector_hls.h.
| std::string TrackState::mFragmentURIFromIndex |
storage for uri generated by GetFragmentUriFromIndex
Definition at line 484 of file fragmentcollector_hls.h.
| long long TrackState::indexFirstMediaSequenceNumber |
first media sequence number from indexed manifest
Definition at line 485 of file fragmentcollector_hls.h.
| char* TrackState::fragmentURI |
pointer (into playlist) to URI of current fragment-of-interest
Definition at line 487 of file fragmentcollector_hls.h.
| long long TrackState::lastPlaylistDownloadTimeMS |
UTC time at which playlist was downloaded
Definition at line 488 of file fragmentcollector_hls.h.
| size_t TrackState::byteRangeLength |
state for #EXT-X-BYTERANGE fragments
Definition at line 489 of file fragmentcollector_hls.h.
| size_t TrackState::byteRangeOffset |
state for #EXT-X-BYTERANGE fragments
Definition at line 490 of file fragmentcollector_hls.h.
| long long TrackState::nextMediaSequenceNumber |
media sequence number following current fragment-of-interest
Definition at line 492 of file fragmentcollector_hls.h.
| double TrackState::playlistPosition |
playlist-relative time of most recent fragment-of-interest; -1 if undefined
Definition at line 493 of file fragmentcollector_hls.h.
| double TrackState::playTarget |
initially relative seek time (seconds) based on playlist window, but updated as a play_target
Definition at line 494 of file fragmentcollector_hls.h.
| double TrackState::lastDownloadedIFrameTarget |
stores last downloaded iframe segment target value for comparison
Definition at line 496 of file fragmentcollector_hls.h.
| double TrackState::targetDurationSeconds |
copy of #EXT-X-TARGETDURATION to manage playlist refresh frequency
Definition at line 497 of file fragmentcollector_hls.h.
| int TrackState::mDeferredDrmKeyMaxTime |
copy of #EXT-X-X1-LIN DRM refresh randomization Max time interval
Definition at line 498 of file fragmentcollector_hls.h.
| StreamOutputFormat TrackState::streamOutputFormat |
type of data encoded in each fragment
Definition at line 499 of file fragmentcollector_hls.h.
| MediaProcessor* TrackState::playContext |
state for s/w demuxer / pts/pcr restamper module
Definition at line 500 of file fragmentcollector_hls.h.
| double TrackState::startTimeForPlaylistSync |
used for time-based track synchronization when switching between playlists
Definition at line 501 of file fragmentcollector_hls.h.
| double TrackState::playTargetOffset |
For correcting timestamps of streams with audio and video tracks
Definition at line 502 of file fragmentcollector_hls.h.
| bool TrackState::discontinuity |
Set when discontinuity is found in track
Definition at line 503 of file fragmentcollector_hls.h.
| StreamAbstractionAAMP_HLS* TrackState::context |
To get settings common across tracks
Definition at line 504 of file fragmentcollector_hls.h.
| bool TrackState::fragmentEncrypted |
In DAI, ad fragments can be clear. Set if current fragment is encrypted
Definition at line 505 of file fragmentcollector_hls.h.
| bool TrackState::mKeyTagChanged |
Flag to indicate Key tag got changed for decryption context setting
Definition at line 506 of file fragmentcollector_hls.h.
| int TrackState::mLastKeyTagIdx |
Variable to hold the last keyTag index,to check if key tag changed
Definition at line 507 of file fragmentcollector_hls.h.
| struct DrmInfo TrackState::mDrmInfo |
Structure variable to hold Drm Information
Definition at line 508 of file fragmentcollector_hls.h.
| char* TrackState::mCMSha1Hash |
variable to store ShaID
Definition at line 509 of file fragmentcollector_hls.h.
| long long TrackState::mDrmTimeStamp |
variable to store Drm Time Stamp
Definition at line 510 of file fragmentcollector_hls.h.
| int TrackState::mDrmMetaDataIndexPosition |
Variable to store Drm Meta data Index position
Definition at line 511 of file fragmentcollector_hls.h.
| GrowableBuffer TrackState::mDrmMetaDataIndex |
DrmMetadata records for associated playlist
Definition at line 512 of file fragmentcollector_hls.h.
| int TrackState::mDrmMetaDataIndexCount |
number of DrmMetadata records in currently indexed playlist
Definition at line 513 of file fragmentcollector_hls.h.
| int TrackState::mDrmKeyTagCount |
number of EXT-X-KEY tags present in playlist
Definition at line 514 of file fragmentcollector_hls.h.
| bool TrackState::mIndexingInProgress |
indicates if indexing is in progress
Definition at line 515 of file fragmentcollector_hls.h.
| GrowableBuffer TrackState::mDiscontinuityIndex |
discontinuity start position mapping of associated playlist
Definition at line 516 of file fragmentcollector_hls.h.
| int TrackState::mDiscontinuityIndexCount |
number of records in discontinuity position index
Definition at line 517 of file fragmentcollector_hls.h.
| bool TrackState::mCheckForInitialFragEnc |
Flag that denotes if we should check for encrypted init header and push it to GStreamer
Definition at line 523 of file fragmentcollector_hls.h.
| DrmKeyMethod TrackState::mDrmMethod |
denotes the X-KEY method for the fragment of interest
Definition at line 524 of file fragmentcollector_hls.h.
| CMCDHeaders* TrackState::pCMCDMetrics |
pointer object to class CMCDHeaders
Definition at line 525 of file fragmentcollector_hls.h.
|
private |
bool flag to indicate if playlist refresh required or not
Definition at line 528 of file fragmentcollector_hls.h.
|
private |
Thread Id for Fragment collector Thread
Definition at line 529 of file fragmentcollector_hls.h.
|
private |
Flag indicating if fragment collector thread started or not
Definition at line 530 of file fragmentcollector_hls.h.
|
private |
Manifest Download fail count for retry
Definition at line 531 of file fragmentcollector_hls.h.
|
private |
Indicates if first indexing is done
Definition at line 532 of file fragmentcollector_hls.h.
|
private |
DRM decrypt context
Definition at line 533 of file fragmentcollector_hls.h.
|
private |
Indicates if DRM License Request is Pending
Definition at line 534 of file fragmentcollector_hls.h.
|
private |
Indicates if init fragment injection is required
Definition at line 535 of file fragmentcollector_hls.h.
|
private |
Holds init fragment Information index
Definition at line 536 of file fragmentcollector_hls.h.
|
private |
Indicates if processing drm metadata to be forced on indexing
Definition at line 537 of file fragmentcollector_hls.h.
|
private |
protect playlist update
Definition at line 538 of file fragmentcollector_hls.h.
|
private |
Notifies after a playlist indexing operation
Definition at line 539 of file fragmentcollector_hls.h.
|
private |
protect DRM Interactions for the track
Definition at line 540 of file fragmentcollector_hls.h.
|
private |
protect playlist discontinuity check
Definition at line 541 of file fragmentcollector_hls.h.
|
private |
Notifies after a discontinuity check
Definition at line 542 of file fragmentcollector_hls.h.
|
private |
Holds discontinuity position last matched by other track
Definition at line 543 of file fragmentcollector_hls.h.
|
private |
Total culled duration in this streamer instance
Definition at line 544 of file fragmentcollector_hls.h.
|
private |
Total culled duration in this streamer instance
Definition at line 545 of file fragmentcollector_hls.h.
|
private |
Indicates if a synchronization after discontinuity tag is in progress
Definition at line 546 of file fragmentcollector_hls.h.
|
private |
Playlist Type
Definition at line 547 of file fragmentcollector_hls.h.
|
private |
Flag indicating if End list tag reached in parser
Definition at line 548 of file fragmentcollector_hls.h.
|
private |
Flag used to calculte byte offset from byte length for fragmented streams
Definition at line 549 of file fragmentcollector_hls.h.
|
private |
Flag that denotes if previous cached fragment is init fragment or not
Definition at line 550 of file fragmentcollector_hls.h.
|
private |
Holds first encrypted init fragment Information index
Definition at line 551 of file fragmentcollector_hls.h.
|
private |
Holds value of time offset from X-Start tag
Definition at line 552 of file fragmentcollector_hls.h.
|
private |
Total culled duration with this asset prior to streamer instantiation
Definition at line 553 of file fragmentcollector_hls.h.
|
private |
Flag used to enable segment skip on fetch error
Definition at line 554 of file fragmentcollector_hls.h.