RDK Documentation (Open Sourced RDK Components)
|
Base Class for Media Track. More...
#include <StreamAbstractionAAMP.h>
Public Member Functions | |
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... | |
virtual void | ABRProfileChanged (void)=0 |
Notifies profile changes to subclasses. More... | |
virtual double | GetBufferedDuration (void)=0 |
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... | |
Data Fields | |
bool | eosReached |
bool | enabled |
int | numberOfFragmentsCached |
int | numberOfFragmentChunksCached |
const char * | name |
double | fragmentDurationSeconds |
int | segDLFailCount |
int | segDrmDecryptFailCount |
int | mSegInjectFailCount |
TrackType | type |
std::unique_ptr< SubtitleParser > | mSubtitleParser |
bool | refreshSubtitles |
int | maxCachedFragmentsPerTrack |
int | maxCachedFragmentChunksPerTrack |
pthread_cond_t | fragmentChunkFetched |
uint32_t | totalMdatCount |
int | noMDATCount |
Protected Member Functions | |
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... | |
virtual class StreamAbstractionAAMP * | GetContext ()=0 |
Get the context of media track. To be implemented by subclasses. More... | |
virtual void | InjectFragmentInternal (CachedFragment *cachedFragment, bool &fragmentDiscarded)=0 |
To be implemented by derived classes to receive cached fragment. 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 | |
static int | GetDeferTimeMs (long maxTimeSeconds) |
Protected Attributes | |
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 |
Static Private Member Functions | |
static const char * | GetBufferHealthStatusString (BufferHealthStatus status) |
Get string corresponding to buffer status. More... | |
Private Attributes | |
pthread_cond_t | fragmentFetched |
pthread_cond_t | fragmentInjected |
pthread_t | fragmentInjectorThreadID |
pthread_cond_t | fragmentChunkInjected |
pthread_t | fragmentChunkInjectorThreadID |
pthread_t | bufferMonitorThreadID |
int | totalFragmentsDownloaded |
int | totalFragmentChunksDownloaded |
bool | fragmentInjectorThreadStarted |
bool | fragmentChunkInjectorThreadStarted |
bool | bufferMonitorThreadStarted |
double | totalInjectedDuration |
double | totalInjectedChunksDuration |
int | currentInitialCacheDurationSeconds |
bool | sinkBufferIsFull |
bool | cachingCompleted |
int | fragmentIdxToInject |
int | fragmentChunkIdxToInject |
int | fragmentIdxToFetch |
int | fragmentChunkIdxToFetch |
int | bandwidthBitsPerSecond |
double | totalFetchedDuration |
bool | discontinuityProcessed |
BufferHealthStatus | bufferStatus |
BufferHealthStatus | prevBufferStatus |
long long | prevDownloadStartTime |
Base Class for Media Track.
Definition at line 159 of file StreamAbstractionAAMP.h.
MediaTrack::StartInjectLoop | ( | ) |
MediaTrack::StartInjectChunkLoop | ( | ) |
Start fragment Chunk injector loop.
Definition at line 1155 of file streamabstraction.cpp.
MediaTrack::StopInjectLoop | ( | ) |
MediaTrack::StopInjectChunkLoop | ( | ) |
Stop fragment chunk injector loop of track.
Definition at line 1285 of file streamabstraction.cpp.
MediaTrack::Enabled | ( | ) |
Check if a track is enabled.
true | if enabled, false if disabled |
Definition at line 1307 of file streamabstraction.cpp.
MediaTrack::InjectFragment | ( | ) |
Inject fragment into the gstreamer.
Definition at line 895 of file streamabstraction.cpp.
MediaTrack::InjectFragmentChunk | ( | ) |
Inject fragment Chunk into the gstreamer.
Definition at line 873 of file streamabstraction.cpp.
|
inline |
Get total fragment injected duration.
Definition at line 245 of file StreamAbstractionAAMP.h.
|
inline |
Get total fragment chunk injected duration.
Definition at line 252 of file StreamAbstractionAAMP.h.
MediaTrack::RunInjectLoop | ( | ) |
Injection loop - use internally by injection logic.
Definition at line 1174 of file streamabstraction.cpp.
MediaTrack::RunInjectChunkLoop | ( | ) |
Run fragment injector loop. Injection loop - use internally by injection logic.
Definition at line 1242 of file streamabstraction.cpp.
MediaTrack::UpdateTSAfterFetch | ( | ) |
Updates internal state after a fragment fetch.
Definition at line 248 of file streamabstraction.cpp.
MediaTrack::UpdateTSAfterChunkFetch | ( | ) |
Updates internal state after a fragment fetch.
Definition at line 324 of file streamabstraction.cpp.
MediaTrack::WaitForFreeFragmentAvailable | ( | int | timeoutMs = -1 | ) |
Wait until a free fragment is available.
timeoutMs | - timeout in milliseconds. -1 for infinite wait |
true | if fragment available, false on abort. |
Definition at line 351 of file streamabstraction.cpp.
MediaTrack::AbortWaitForCachedAndFreeFragment | ( | bool | immediate | ) |
Abort the waiting for cached fragments and free fragment slot.
[in] | immediate | - Forced or lazy abort as in a seek/ stop |
Definition at line 579 of file streamabstraction.cpp.
|
pure virtual |
Notifies profile changes to subclasses.
Implemented in TrackState, and MediaStreamContext.
|
inline |
Get number of fragments dpownloaded.
Definition at line 310 of file StreamAbstractionAAMP.h.
MediaTrack::GetFetchBuffer | ( | bool | initialize | ) |
Get buffer to store the downloaded fragment content to cache next fragment.
[in] | initialize | - Buffer to to initialized or not |
Definition at line 1316 of file streamabstraction.cpp.
MediaTrack::GetFetchChunkBuffer | ( | bool | initialize | ) |
Get buffer to fetch and cache next fragment chunk.
[in] | initialize | true to initialize the fragment chunk |
Pointer | to fragment chunk buffer. |
Definition at line 1334 of file streamabstraction.cpp.
MediaTrack::SetCurrentBandWidth | ( | int | bandwidthBps | ) |
Set current bandwidth of track.
[in] | bandwidthBps | - Bandwidth in bps |
Definition at line 1361 of file streamabstraction.cpp.
MediaTrack::GetProfileIndexForBW | ( | long | mTsbBandwidth | ) |
Get profile index for TsbBandwidth.
mTsbBandwidth | - bandwidth to identify profile index from list |
profile | index of the current bandwidth |
Definition at line 1369 of file streamabstraction.cpp.
MediaTrack::GetCurrentBandWidth | ( | ) |
Get current bandwidth in bps.
Definition at line 1377 of file streamabstraction.cpp.
|
inline |
Get total duration of fetched fragments.
Definition at line 354 of file StreamAbstractionAAMP.h.
|
inline |
Get total duration of fetched fragments.
Definition at line 361 of file StreamAbstractionAAMP.h.
|
inline |
Check if discontinuity is being processed.
Definition at line 368 of file StreamAbstractionAAMP.h.
BufferHealthStatus MediaTrack::GetBufferStatus | ( | ) |
Get buffer Status of track.
Definition at line 83 of file streamabstraction.cpp.
|
inline |
Get buffer health status.
Definition at line 386 of file StreamAbstractionAAMP.h.
MediaTrack::AbortWaitForCachedFragment | ( | ) |
Abort the waiting for cached fragments immediately.
Definition at line 614 of file streamabstraction.cpp.
|
inline |
Check whether track data injection is aborted.
Definition at line 400 of file StreamAbstractionAAMP.h.
MediaTrack::CheckForFutureDiscontinuity | ( | double & | cacheDuration | ) |
To check for discontinuity in future fragments.
[out] | cacheDuration | - cached fragment duration in seconds |
Definition at line 2640 of file streamabstraction.cpp.
void MediaTrack::OnSinkBufferFull | ( | ) |
MediaTrack::FlushFragments | ( | ) |
Flushes all cached fragments Flushes all media fragments and resets all relevant counters Only intended for use on subtitle streams.
Definition at line 1387 of file streamabstraction.cpp.
MediaTrack::FlushFragmentChunks | ( | ) |
Flushes all cached fragment Chunks.
Definition at line 1405 of file streamabstraction.cpp.
|
protected |
Update segment cache and inject buffer to gstreamer.
Definition at line 185 of file streamabstraction.cpp.
|
protected |
Update segment cache and inject buffer to gstreamer.
Definition at line 212 of file streamabstraction.cpp.
|
protected |
Wait till cached fragment available.
Definition at line 458 of file streamabstraction.cpp.
|
protected |
Wait until a cached fragment chunk is Injected.
true | if fragment chunk injected , false on abort. |
Definition at line 490 of file streamabstraction.cpp.
|
protected |
Wait till cached fragment chunk available.
Definition at line 543 of file streamabstraction.cpp.
|
protectedpure virtual |
Get the context of media track. To be implemented by subclasses.
Implemented in TrackState, and MediaStreamContext.
|
protectedpure virtual |
To be implemented by derived classes to receive cached fragment.
[in] | cachedFragment | - contains fragment to be processed and injected |
[out] | fragmentDiscarded | - true if fragment is discarded. |
Implemented in TrackState, and MediaStreamContext.
|
protected |
To be implemented by derived classes to receive cached fragment Chunk Receives cached fragment and injects to sink.
[in] | cachedFragmentChunk | - contains fragment to be processed and injected |
[out] | fragmentChunkDiscarded | - true if fragment is discarded. |
Definition at line 238 of file streamabstraction.cpp.
|
inlineprotectedvirtual |
To be implemented by derived classes if discontinuity on trick-play is to be notified.
Reimplemented in MediaStreamContext.
Definition at line 503 of file StreamAbstractionAAMP.h.
|
staticprivate |
Get string corresponding to buffer status.
Definition at line 61 of file streamabstraction.cpp.
bool MediaTrack::eosReached |
set to true when a vod asset has been played to completion
Definition at line 514 of file StreamAbstractionAAMP.h.
bool MediaTrack::enabled |
set to true if track is enabled
Definition at line 515 of file StreamAbstractionAAMP.h.
int MediaTrack::numberOfFragmentsCached |
Number of fragments cached in this track
Definition at line 516 of file StreamAbstractionAAMP.h.
int MediaTrack::numberOfFragmentChunksCached |
Number of fragments cached in this track
Definition at line 517 of file StreamAbstractionAAMP.h.
const char* MediaTrack::name |
Track name used for debugging
Definition at line 518 of file StreamAbstractionAAMP.h.
double MediaTrack::fragmentDurationSeconds |
duration in seconds for current fragment-of-interest
Definition at line 519 of file StreamAbstractionAAMP.h.
int MediaTrack::segDLFailCount |
Segment download fail count
Definition at line 520 of file StreamAbstractionAAMP.h.
int MediaTrack::segDrmDecryptFailCount |
Segment decryption failure count
Definition at line 521 of file StreamAbstractionAAMP.h.
int MediaTrack::mSegInjectFailCount |
Segment Inject/Decode fail count
Definition at line 522 of file StreamAbstractionAAMP.h.
TrackType MediaTrack::type |
Media type of the track
Definition at line 523 of file StreamAbstractionAAMP.h.
std::unique_ptr<SubtitleParser> MediaTrack::mSubtitleParser |
Parser for subtitle data
Definition at line 524 of file StreamAbstractionAAMP.h.
bool MediaTrack::refreshSubtitles |
Switch subtitle track in the FetchLoop
Definition at line 525 of file StreamAbstractionAAMP.h.
pthread_cond_t MediaTrack::fragmentChunkFetched |
Signaled after a fragment Chunk is fetched
Definition at line 528 of file StreamAbstractionAAMP.h.
uint32_t MediaTrack::totalMdatCount |
Total MDAT Chunk Found
Definition at line 529 of file StreamAbstractionAAMP.h.
int MediaTrack::noMDATCount |
MDAT Chunk Not Found count continuously while chunk buffer processoing
Definition at line 530 of file StreamAbstractionAAMP.h.
|
protected |
Pointer to the PrivateInstanceAAMP
Definition at line 534 of file StreamAbstractionAAMP.h.
|
protected |
storage for currently-downloaded fragment
Definition at line 535 of file StreamAbstractionAAMP.h.
|
protected |
Buffer to keep fragment content
Definition at line 537 of file StreamAbstractionAAMP.h.
|
protected |
Buffer to keep fragment content
Definition at line 538 of file StreamAbstractionAAMP.h.
|
protected |
Abort all operations if flag is set
Definition at line 539 of file StreamAbstractionAAMP.h.
|
protected |
protection of track variables accessed from multiple threads
Definition at line 540 of file StreamAbstractionAAMP.h.
|
protected |
flag to indicate if last injected fragment has ptsError
Definition at line 541 of file StreamAbstractionAAMP.h.
|
protected |
Abort inject operations if flag is set
Definition at line 542 of file StreamAbstractionAAMP.h.
|
protected |
Abort inject operations if flag is set
Definition at line 543 of file StreamAbstractionAAMP.h.
|
private |
Signaled after a fragment is fetched
Definition at line 546 of file StreamAbstractionAAMP.h.
|
private |
Signaled after a fragment is injected
Definition at line 547 of file StreamAbstractionAAMP.h.
|
private |
Fragment injector thread id
Definition at line 548 of file StreamAbstractionAAMP.h.
|
private |
Signaled after a fragment is injected
Definition at line 549 of file StreamAbstractionAAMP.h.
|
private |
Fragment injector thread id
Definition at line 550 of file StreamAbstractionAAMP.h.
|
private |
Buffer Monitor thread id
Definition at line 551 of file StreamAbstractionAAMP.h.
|
private |
Total fragments downloaded since start by track
Definition at line 552 of file StreamAbstractionAAMP.h.
|
private |
Total fragments downloaded since start by track
Definition at line 553 of file StreamAbstractionAAMP.h.
|
private |
Fragment injector's thread started or not
Definition at line 554 of file StreamAbstractionAAMP.h.
|
private |
Fragment Chunk injector's thread started or not
Definition at line 555 of file StreamAbstractionAAMP.h.
|
private |
Buffer Monitor thread started or not
Definition at line 556 of file StreamAbstractionAAMP.h.
|
private |
Total fragment injected duration
Definition at line 557 of file StreamAbstractionAAMP.h.
|
private |
Total fragment injected chunk duration
Definition at line 558 of file StreamAbstractionAAMP.h.
|
private |
Current cached fragments duration before playing
Definition at line 559 of file StreamAbstractionAAMP.h.
|
private |
True if sink buffer is full and do not want new fragments
Definition at line 560 of file StreamAbstractionAAMP.h.
|
private |
Fragment caching completed or not
Definition at line 561 of file StreamAbstractionAAMP.h.
|
private |
Write position
Definition at line 562 of file StreamAbstractionAAMP.h.
|
private |
Write position
Definition at line 563 of file StreamAbstractionAAMP.h.
|
private |
Read position
Definition at line 564 of file StreamAbstractionAAMP.h.
|
private |
Read position
Definition at line 565 of file StreamAbstractionAAMP.h.
|
private |
Bandwidth of last selected profile
Definition at line 566 of file StreamAbstractionAAMP.h.
|
private |
Total fragment fetched duration
Definition at line 567 of file StreamAbstractionAAMP.h.
|
private |
Buffer status of the track
Definition at line 569 of file StreamAbstractionAAMP.h.
|
private |
Previous buffer status of the track
Definition at line 570 of file StreamAbstractionAAMP.h.
|
private |
Previous file download Start time
Definition at line 571 of file StreamAbstractionAAMP.h.