RDK Documentation (Open Sourced RDK Components)
|
Fragment collector implementation of MPEG DASH. More...
#include "iso639map.h"
#include "fragmentcollector_mpd.h"
#include "MediaStreamContext.h"
#include "AampFnLogger.h"
#include "priv_aamp.h"
#include "AampDRMSessionManager.h"
#include "AampConstants.h"
#include "SubtecFactory.hpp"
#include <stdlib.h>
#include <string.h>
#include "_base64.h"
#include <pthread.h>
#include <signal.h>
#include <assert.h>
#include <unistd.h>
#include <set>
#include <iomanip>
#include <ctime>
#include <inttypes.h>
#include <libxml/xmlreader.h>
#include <math.h>
#include <cmath>
#include <algorithm>
#include <cctype>
#include <regex>
#include "AampCacheHandler.h"
#include "AampUtils.h"
#include "AampRfc.h"
#include <chrono>
Go to the source code of this file.
Data Structures | |
class | PeriodElement |
Consists Adaptation Set and representation-specific parts. More... | |
class | SegmentTemplates |
Handles operation and information on segment template from manifest. More... | |
class | HeaderFetchParams |
Holds information regarding initialization fragment. More... | |
class | FragmentDownloadParams |
Holds data of fragment to be downloaded. More... | |
struct | EarlyAvailablePeriodInfo |
Period Information available at early. More... | |
Macros | |
#define | SEGMENT_COUNT_FOR_ABR_CHECK 5 |
#define | DEFAULT_INTERVAL_BETWEEN_MPD_UPDATES_MS 3000 |
#define | TIMELINE_START_RESET_DIFF 4000000000 |
#define | MAX_DELAY_BETWEEN_MPD_UPDATE_MS (6000) |
#define | MIN_DELAY_BETWEEN_MPD_UPDATE_MS (500) |
#define | MIN_TSB_BUFFER_DEPTH 6 |
#define | VSS_DASH_EARLY_AVAILABLE_PERIOD_PREFIX "vss-" |
#define | FOG_INSERTED_PERIOD_ID_PREFIX "FogPeriod" |
#define | INVALID_VOD_DURATION (0) |
#define | SUPPLEMENTAL_PROPERTY_TAG "SupplementalProperty" |
#define | SCHEME_ID_URI_EC3_EXT_CODEC "tag:dolby.com,2018:dash:EC3_ExtensionType:2018" |
#define | EC3_EXT_VALUE_AUDIO_ATMOS "JOC" |
#define | MEDIATYPE_VIDEO "video" |
#define | MEDIATYPE_AUDIO "audio" |
#define | MEDIATYPE_TEXT "text" |
#define | MEDIATYPE_AUX_AUDIO "aux-audio" |
#define | MEDIATYPE_IMAGE "image" |
#define | AAMP_LANGUAGE_SCORE 1000000000UL |
#define | AAMP_SCHEME_ID_SCORE 100000000L |
#define | AAMP_LABEL_SCORE 10000000L |
#define | AAMP_ROLE_SCORE 1000000L |
#define | AAMP_TYPE_SCORE 100000L |
#define | AAMP_CODEC_SCORE 1000L |
#define | MAX_EVENT_STARTIME (24*60*60*1000) |
#define | PRESELECTION_PROPERTY_TAG "Preselection" |
#define | ACCESSIBILITY_PROPERTY_TAG "Accessibility" |
#define | CHANNEL_PROPERTY_TAG "AudioChannelConfiguration" |
#define | CHANNEL_SCHEME_ID_TAG "urn:mpeg:mpegB:cicp:ChannelConfiguration" |
#define | ROLE_PROPERTY_TAG "Role" |
#define | ROLE_SCHEME_ID_TAG "urn:mpeg:dash:role:2011" |
Functions | |
static double | ParseISO8601Duration (const char *ptr) |
Parse duration from ISO8601 string. More... | |
static double | ComputeFragmentDuration (uint32_t duration, uint32_t timeScale) |
static bool | IsIframeTrack (IAdaptationSet *adaptationSet) |
Check if adaptation set is iframe track. More... | |
static void | GetBitrateInfoFromCustomMpd (const IAdaptationSet *adaptationSet, std::vector< Representation * > &representations) |
Extract bitrate info from custom mpd. More... | |
static bool | IsCompatibleMimeType (const std::string &mimeType, MediaType mediaType) |
Check if mime type is compatible with media type. More... | |
static bool | IsAtmosAudio (const IMPDElement *nodePtr) |
Get Additional tag property value from any child node of MPD. More... | |
static AudioType | getCodecType (string &codecValue, const IMPDElement *rep) |
Get codec value from representation level. More... | |
static int | GetDesiredCodecIndex (IAdaptationSet *adaptationSet, AudioType &selectedCodecType, uint32_t &selectedRepBandwidth, bool disableEC3, bool disableATMOS, bool disableAC4, bool disableAC3, bool &disabled) |
static int | GetDesiredVideoCodecIndex (IAdaptationSet *adaptationSet) |
Get representation index of desired video codec. More... | |
static const char * | getMediaTypeName (MediaType mediaType) |
Return the name corresponding to the Media Type. More... | |
static bool | IsContentType (const IAdaptationSet *adaptationSet, MediaType mediaType) |
Check if adaptation set is of a given media type. More... | |
static unsigned int | Read32 (const char **pptr) |
read unsigned 32 bit value and update buffer pointer More... | |
static bool | ParseSegmentIndexBox (const char *start, size_t size, int segmentIndex, unsigned int *referenced_size, float *referenced_duration, unsigned int *firstOffset) |
Parse segment index box. More... | |
static int | replace (std::string &str, const std::string &from, uint64_t toNumber) |
Replace matching token with given number. More... | |
static int | replace (std::string &str, const std::string &from, const std::string &toString) |
Replace matching token with given string. More... | |
static AampCurlInstance | getCurlInstanceByMediaType (MediaType type) |
Gets a curlInstance index for a given MediaType. More... | |
static void | deIndexTileInfo (std::vector< TileInfo > &indexedTileInfo) |
static void | AddAttributesToNode (xmlTextReaderPtr *reader, Node *node) |
Add attriblutes to xml node. More... | |
Node * | aamp_ProcessNode (xmlTextReaderPtr *reader, std::string url, bool isAd) |
Get xml node form reader. More... | |
double | safeMultiply (const unsigned int first, const unsigned int second) |
static void | ParseXmlNS (const std::string &fullName, std::string &ns, std::string &name) |
Parse XML NS. More... | |
uint64_t | GetFirstSegmentStartTime (IPeriod *period) |
GetFirstSegment start time from period. More... | |
uint32_t | GetPeriodSegmentTimeScale (IPeriod *period) |
GetPeriod Segment timescale from period. More... | |
double | aamp_GetPeriodNewContentDuration (dash::mpd::IMPD *mpd, IPeriod *period, uint64_t &curEndNumber) |
double | aamp_GetPeriodStartTimeDeltaRelativeToPTSOffset (IPeriod *period) |
Get difference between first segment start time and presentation offset from period. More... | |
void | ParseCCStreamIDAndLang (std::string input, std::string &id, std::string &lang) |
Parse CC streamID and language from value. More... | |
double | aamp_GetPeriodDuration (dash::mpd::IMPD *mpd, int periodIndex, uint64_t mpdDownloadTime) |
Get Period Duration. More... | |
uint64_t | aamp_GetDurationFromRepresentation (dash::mpd::IMPD *mpd) |
Get duration though representation iteration. More... | |
static void * | TrackDownloader (void *arg) |
Fragment downloader thread. More... | |
static void * | FragmentDownloader (void *arg) |
Fragment downloader thread. More... | |
StreamOutputFormat | GetSubtitleFormat (std::string mimeType) |
static void | indexThumbnails (dash::mpd::IMPD *mpd, int thumbIndexValue, std::vector< TileInfo > &indexedTileInfo, std::vector< StreamInfo * > &thumbnailtrack) |
static int | getChannel (INode *nodePtr) |
Get the cannel number from preselection node. More... | |
static std::string | getRole (INode *nodePtr) |
static void * | LatencyMonitor (void *arg) |
Latency monitor thread. More... | |
Fragment collector implementation of MPEG DASH.
Definition in file fragmentcollector_mpd.cpp.
class FragmentDownloadParams |
Holds data of fragment to be downloaded.
Definition at line 262 of file fragmentcollector_mpd.cpp.
Data Fields | ||
---|---|---|
class StreamAbstractionAAMP_MPD * | context | |
class MediaStreamContext * | pMediaStreamContext | |
bool | playingLastPeriod | |
long long | lastPlaylistUpdateMS |
#define SUPPLEMENTAL_PROPERTY_TAG "SupplementalProperty" |
Macros for extended audio codec check as per ETSI-TS-103-420-V1.2.1
Definition at line 76 of file fragmentcollector_mpd.cpp.
#define AAMP_LANGUAGE_SCORE 1000000000UL |
Top priority: matching language
Definition at line 87 of file fragmentcollector_mpd.cpp.
#define AAMP_SCHEME_ID_SCORE 100000000L |
2nd priority to scheme id matching
Definition at line 88 of file fragmentcollector_mpd.cpp.
#define AAMP_LABEL_SCORE 10000000L |
3rd priority to label matching
Definition at line 89 of file fragmentcollector_mpd.cpp.
#define AAMP_ROLE_SCORE 1000000L |
4th priority to role/rendition matching
Definition at line 90 of file fragmentcollector_mpd.cpp.
#define AAMP_TYPE_SCORE 100000L |
5th priority to type matching
Definition at line 91 of file fragmentcollector_mpd.cpp.
#define AAMP_CODEC_SCORE 1000L |
Lowest priority: matchng codec
Definition at line 92 of file fragmentcollector_mpd.cpp.
#define PRESELECTION_PROPERTY_TAG "Preselection" |
TBD : Move to Dash Utils
Definition at line 11265 of file fragmentcollector_mpd.cpp.
|
static |
Parse duration from ISO8601 string.
ptr | ISO8601 string |
Definition at line 3012 of file fragmentcollector_mpd.cpp.
|
static |
Check if adaptation set is iframe track.
adaptationSet | Pointer to adaptainSet |
true | if iframe track |
Definition at line 6141 of file fragmentcollector_mpd.cpp.
|
static |
Extract bitrate info from custom mpd.
adaptationSet | : AdaptaionSet from which bitrate info is to be extracted | |
[out] | representations | : Representation vector gets updated with Available bit rates. |
Definition at line 7364 of file fragmentcollector_mpd.cpp.
|
static |
Check if mime type is compatible with media type.
mimeType | mime type |
mediaType | media type |
true | if compatible |
Definition at line 401 of file fragmentcollector_mpd.cpp.
|
static |
Get Additional tag property value from any child node of MPD.
nodePtr | Pointer to MPD child node, Tage Name , Property Name, SchemeIdUri (if the propery mapped against scheme Id , default value is empty) |
return | the property name if found, if not found return empty string |
Definition at line 440 of file fragmentcollector_mpd.cpp.
|
static |
Get codec value from representation level.
[out] | codecValue | - string value of codec as per manifest |
[in] | rep | - representation node for atmos audio check |
audio | type as per aamp code from string value |
Definition at line 485 of file fragmentcollector_mpd.cpp.
|
static |
Get representation index of desired video codec.
adaptationSet | Adaptation set object | |
[out] | selectedRepIdx | index of desired representation |
index | of desired representation |
Definition at line 710 of file fragmentcollector_mpd.cpp.
|
static |
Return the name corresponding to the Media Type.
mediaType | media type |
the | name of the mediaType |
Definition at line 739 of file fragmentcollector_mpd.cpp.
|
static |
Check if adaptation set is of a given media type.
adaptationSet | adaptation set |
mediaType | media type |
true | if adaptation set is of the given media type |
Definition at line 765 of file fragmentcollector_mpd.cpp.
|
static |
read unsigned 32 bit value and update buffer pointer
[in] | pptr | buffer |
32 | bit value |
Definition at line 819 of file fragmentcollector_mpd.cpp.
|
static |
Parse segment index box.
start | start of box | |
size | size of box | |
segmentIndex | segment index | |
[out] | referenced_size | referenced size |
[out] | referenced_duration | referenced duration |
true | on success |
Definition at line 843 of file fragmentcollector_mpd.cpp.
|
static |
Replace matching token with given number.
str | String in which operation to be performed |
from | token |
toNumber | number to replace token |
position |
Definition at line 906 of file fragmentcollector_mpd.cpp.
|
static |
Replace matching token with given string.
str | String in which operation to be performed |
from | token |
toString | string to replace token |
position |
Definition at line 985 of file fragmentcollector_mpd.cpp.
|
static |
Gets a curlInstance index for a given MediaType.
type | the stream MediaType |
AampCurlInstance | index to curl_easy_perform session |
Definition at line 1095 of file fragmentcollector_mpd.cpp.
|
static |
Add attriblutes to xml node.
reader | xmlTextReaderPtr |
node | xml Node |
Definition at line 2814 of file fragmentcollector_mpd.cpp.
Node* aamp_ProcessNode | ( | xmlTextReaderPtr * | reader, |
std::string | url, | ||
bool | isAd | ||
) |
Get xml node form reader.
xml | node |
Definition at line 2914 of file fragmentcollector_mpd.cpp.
|
static |
Parse XML NS.
fullName | full name of node | |
[out] | ns | namespace |
[out] | name | name after : |
Definition at line 3115 of file fragmentcollector_mpd.cpp.
uint64_t GetFirstSegmentStartTime | ( | IPeriod * | period | ) |
GetFirstSegment start time from period.
period |
start | time |
Definition at line 3498 of file fragmentcollector_mpd.cpp.
uint32_t GetPeriodSegmentTimeScale | ( | IPeriod * | period | ) |
GetPeriod Segment timescale from period.
period | Segment period |
timescale |
Definition at line 3541 of file fragmentcollector_mpd.cpp.
double aamp_GetPeriodStartTimeDeltaRelativeToPTSOffset | ( | IPeriod * | period | ) |
Get difference between first segment start time and presentation offset from period.
start | time delta in seconds |
Definition at line 3661 of file fragmentcollector_mpd.cpp.
void ParseCCStreamIDAndLang | ( | std::string | input, |
std::string & | id, | ||
std::string & | lang | ||
) |
Parse CC streamID and language from value.
[in] | input | - input value |
[out] | id | - stream ID value |
[out] | lang | - language value |
Definition at line 3725 of file fragmentcollector_mpd.cpp.
double aamp_GetPeriodDuration | ( | dash::mpd::IMPD * | mpd, |
int | periodIndex, | ||
uint64_t | mpdDownloadTime | ||
) |
Get Period Duration.
period | duration in milli seconds |
Definition at line 3966 of file fragmentcollector_mpd.cpp.
uint64_t aamp_GetDurationFromRepresentation | ( | dash::mpd::IMPD * | mpd | ) |
Get duration though representation iteration.
duration | in milliseconds |
Definition at line 4874 of file fragmentcollector_mpd.cpp.
|
static |
Fragment downloader thread.
arg | HeaderFetchParams pointer |
Definition at line 6066 of file fragmentcollector_mpd.cpp.
|
static |
Fragment downloader thread.
arg | Pointer to FragmentDownloadParams object |
NULL |
Definition at line 6095 of file fragmentcollector_mpd.cpp.
|
static |
Get the cannel number from preselection node.
TBD : Move to Dash Utils
preselection | ndoe as nodePtr |
Definition at line 11280 of file fragmentcollector_mpd.cpp.
|
static |
Latency monitor thread.
arg | Pointer to FragmentCollector |
NULL |
Definition at line 11785 of file fragmentcollector_mpd.cpp.