|
RDK Documentation (Open Sourced RDK Components)
|
Go to the documentation of this file.
25 #ifndef __AAMP_CACHE_HANDLER_H__
26 #define __AAMP_CACHE_HANDLER_H__
30 #include <unordered_map>
33 #define PLAYLIST_CACHE_SIZE_UNLIMITED -1
39 std::string mEffectiveUrl;
50 mCachedBuffer->
ptr = p.mCachedBuffer->
ptr;
51 mCachedBuffer->
len = p.mCachedBuffer->
len;
57 mEffectiveUrl = p.mEffectiveUrl;
58 mCachedBuffer = p.mCachedBuffer;
59 mFileType = p.mFileType;
60 mDuplicateEntry = p.mDuplicateEntry;
98 std::queue<std::string> Trackqueue;
113 typedef std::unordered_map<std::string, PlayListCachedData *> PlaylistCache ;
114 typedef std::unordered_map<std::string, PlayListCachedData *>::iterator PlaylistCacheIter;
115 PlaylistCache mPlaylistCache;
116 int mCacheStoredSize;
119 bool mAsyncCacheCleanUpThread;
120 bool mAsyncThreadStartedFlag;
121 int mMaxPlaylistCacheSize;
122 pthread_mutex_t mMutex;
123 pthread_mutex_t mCondVarMutex;
124 pthread_cond_t mCondVar ;
125 pthread_t mAsyncCleanUpTaskThreadId;
128 typedef std::unordered_map <std::string, InitFragCacheStruct*> InitFragCache ;
129 typedef std::unordered_map <std::string, InitFragCacheStruct*>::iterator InitFragCacheIter;
130 typedef std::unordered_map <MediaType, InitFragTrackStruct*, std::hash<int>> CacheTrackQueue;
131 typedef std::unordered_map <MediaType, InitFragTrackStruct*, std::hash<int>>::iterator CacheTrackQueueIter;
132 InitFragCache umInitFragCache;
133 CacheTrackQueue umCacheTrackQ;
134 pthread_mutex_t mInitFragMutex;
258 int GetMaxPlaylistCacheSize() {
return mMaxPlaylistCacheSize; }
AampCacheHandler(AampLogManager *logObj)
Default Constructor.
void Init()
Initialization Function.
void InsertToPlaylistCache(const std::string url, const GrowableBuffer *buffer, std::string effectiveUrl, bool trackLiveStatus, MediaType fileType=eMEDIATYPE_DEFAULT)
Retrieve playlist from cache
void StartPlaylistCache()
Start playlist caching.
static void * AampCacheThreadFunction(void *This)
Thread entry function.
~AampCacheHandler()
Destructor Function.
bool RetrieveFromInitFragCache(const std::string url, GrowableBuffer *buffer, std::string &effectiveUrl)
Retrieve init fragment from cache.
initfragtrackstruct to store init fragment url per media track in FIFO Queue.
bool RetrieveFromPlaylistCache(const std::string url, GrowableBuffer *buffer, std::string &effectiveUrl)
Retrieve playlist from cache.
bool IsUrlCached(std::string)
IsUrlCached - Check if URL is already cached.
void RemoveFromPlaylistCache(const std::string url)
Remove specific playlist cache.
void InsertToInitFragCache(const std::string url, const GrowableBuffer *buffer, std::string effectiveUrl, MediaType fileType)
Insert init fragment into cache table.
void StopPlaylistCache()
Stop playlist caching.
PlayListCachedData structure to store playlist data.
struct initfragtrackstruct InitFragTrackStruct
initfragtrackstruct to store init fragment url per media track in FIFO Queue.
Private functions and types used internally by AAMP.
Structure of GrowableBuffer.
Handles Aamp Cahe operations.
AampCacheHandler & operator=(const AampCacheHandler &)=delete
assignment operator disabled
void ClearCacheHandler()
Clear Cache Handler. Exit clean up thread.
void SetMaxInitFragCacheSize(int maxInitFragCacheSz)
SetMaxInitFragCacheSize - Set Max Cache Size.
void SetMaxPlaylistCacheSize(int maxPlaylistCacheSz)
SetMaxPlaylistCacheSize - Set Max Cache Size.
bool AllocatePlaylistCacheSlot(MediaType fileType, size_t newLen)
AllocatePlaylistCacheSlot Allocate Slot for adding new playlist.
void ClearPlaylistCache()
Clear playlist cache.
struct playlistcacheddata PlayListCachedData
PlayListCachedData structure to store playlist data.
void RemoveInitFragCacheEntry(MediaType fileType)
Removes very first inserted entry ( and duplicate entry, if present) of given filetype from fragment ...
void AsyncCacheCleanUpTask()
Thread function for Async Cache clean.
int GetMaxInitFragCacheSize()
GetMaxPlaylistCacheSize - Get present CacheSize.
void ClearInitFragCache()
Clear init fragment cache & track queue table.