RDK Documentation (Open Sourced RDK Components)
|
Controller for managing DRM sessions. More...
#include <AampDRMSessionManager.h>
Public Member Functions | |
AampDRMSessionManager (AampLogManager *logObj, int maxDrmSessions) | |
AampDRMSessionManager constructor. | |
void | initializeDrmSessions () |
~AampDRMSessionManager () | |
AampDRMSessionManager Destructor. | |
AampDrmSession * | createDrmSession (const char *systemId, MediaFormat mediaFormat, const unsigned char *initDataPtr, uint16_t dataLength, MediaType streamType, PrivateInstanceAAMP *aamp, DrmMetaDataEventPtr e, const unsigned char *contentMetadata=nullptr, bool isPrimarySession=false) |
Creates and/or returns the DRM session corresponding to keyId (Present in initDataPtr) AampDRMSession manager has two static AampDrmSession objects. This method will return the existing DRM session pointer if any one of these static DRM session objects are created against requested keyId. Binds the oldest DRM Session with new keyId if no matching keyId is found in existing sessions. More... | |
AampDrmSession * | createDrmSession (std::shared_ptr< AampDrmHelper > drmHelper, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance, MediaType streamType) |
Create DrmSession by using the AampDrmHelper object. | |
DrmData * | getLicense (AampLicenseRequest &licRequest, int32_t *httpError, MediaType streamType, PrivateInstanceAAMP *aamp, bool isContentMetadataAvailable=false, std::string licenseProxy="") |
Get DRM license key from DRM server. More... | |
bool | IsKeyIdUsable (std::vector< uint8_t > keyIdArray) |
Get DRM license key from DRM server. More... | |
void | clearSessionData () |
Clean up the memory used by session variables. More... | |
void | clearAccessToken () |
Clean up the memory for accessToken. More... | |
void | clearFailedKeyIds () |
Clean up the failed keyIds. More... | |
void | clearDrmSession (bool forceClearSession=false) |
Clean up the Session Data if license key acquisition failed or if LicenseCaching is false. More... | |
void | setVideoWindowSize (int width, int height) |
void | setPlaybackSpeedState (int speed, double position, bool delayNeeded=false) |
void | setSessionMgrState (SessionMgrState state) |
Set Session manager state. More... | |
SessionMgrState | getSessionMgrState () |
Get Session manager state. More... | |
void | setCurlAbort (bool isAbort) |
Set Session abort flag. More... | |
bool | getCurlAbort (void) |
Get Session abort flag. More... | |
void | setLicenseRequestAbort (bool isAbort) |
Get Session abort flag. More... | |
const char * | getAccessToken (int &tokenLength, long &error_code, bool bSslPeerVerify) |
Get the accessToken from authService. More... | |
KeyState | getDrmSession (std::shared_ptr< AampDrmHelper > drmHelper, int &selectedSlot, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance, bool isPrimarySession=false) |
Create a DRM Session using the Drm Helper Determine a slot in the drmSession Contexts which can be used. More... | |
KeyState | initializeDrmSession (std::shared_ptr< AampDrmHelper > drmHelper, int sessionSlot, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance) |
Initialize the Drm System with InitData(PSSH) | |
KeyState | acquireLicense (std::shared_ptr< AampDrmHelper > drmHelper, int sessionSlot, int &cdmError, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance, MediaType streamType) |
sent license challenge to the DRM server and provide the respone to CDM | |
KeyState | handleLicenseResponse (std::shared_ptr< AampDrmHelper > drmHelper, int sessionSlot, int &cdmError, int32_t httpResponseCode, int32_t httpExtResponseCode, shared_ptr< DrmData > licenseResponse, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance) |
KeyState | processLicenseResponse (std::shared_ptr< AampDrmHelper > drmHelper, int sessionSlot, int &cdmError, shared_ptr< DrmData > licenseResponse, DrmMetaDataEventPtr eventHandle, PrivateInstanceAAMP *aampInstance) |
bool | configureLicenseServerParameters (std::shared_ptr< AampDrmHelper > drmHelper, AampLicenseRequest &licRequest, std::string &licenseServerProxy, const AampChallengeInfo &challengeInfo, PrivateInstanceAAMP *aampInstance) |
Configure the Drm license server parameters for URL/proxy and custom http request headers. | |
void | notifyCleanup () |
Resethe current seesion ID. | |
void | ContentProtectionDataUpdate (PrivateInstanceAAMP *aampInstance, std::vector< uint8_t > keyId, MediaType streamType) |
Private Member Functions | |
AampDRMSessionManager (const AampDRMSessionManager &)=delete | |
Copy constructor disabled. More... | |
AampDRMSessionManager & | operator= (const AampDRMSessionManager &)=delete |
assignment operator disabled More... | |
Static Private Member Functions | |
static size_t | write_callback (char *ptr, size_t size, size_t nmemb, void *userdata) |
Curl write callback, used to get the curl o/p from DRM license, accessToken curl requests. More... | |
static int | progress_callback (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) |
Private Attributes | |
AampLogManager * | mLogObj |
DrmSessionContext * | drmSessionContexts |
KeyID * | cachedKeyIDs |
char * | accessToken |
int | accessTokenLen |
SessionMgrState | sessionMgrState |
pthread_mutex_t | accessTokenMutex |
pthread_mutex_t | cachedKeyMutex |
pthread_mutex_t | mDrmSessionLock |
bool | curlSessionAbort |
bool | licenseRequestAbort |
bool | mEnableAccessAtrributes |
int | mMaxDRMSessions |
Controller for managing DRM sessions.
Definition at line 145 of file AampDRMSessionManager.h.
|
privatedelete |
Copy constructor disabled.
|
privatedelete |
assignment operator disabled
|
staticprivate |
Curl write callback, used to get the curl o/p from DRM license, accessToken curl requests.
[in] | ptr | - Pointer to received data. |
[in] | size,nmemb | - Size of received data (size * nmemb). |
[out] | userdata | - Pointer to buffer where the received data is copied. |
Definition at line 333 of file AampDRMSessionManager.cpp.
|
staticprivate |
clientp | app-specific as optionally set with CURLOPT_PROGRESSDATA |
dltotal | total bytes expected to download |
dlnow | downloaded bytes so far |
ultotal | total bytes expected to upload |
ulnow | uploaded bytes so far |
Return | non-zero for CURLE_ABORTED_BY_CALLBACK |
Definition at line 308 of file AampDRMSessionManager.cpp.
AampDrmSession * AampDRMSessionManager::createDrmSession | ( | const char * | systemId, |
MediaFormat | mediaFormat, | ||
const unsigned char * | initDataPtr, | ||
uint16_t | initDataLen, | ||
MediaType | streamType, | ||
PrivateInstanceAAMP * | aamp, | ||
DrmMetaDataEventPtr | e, | ||
const unsigned char * | contentMetadataPtr = nullptr , |
||
bool | isPrimarySession = false |
||
) |
Creates and/or returns the DRM session corresponding to keyId (Present in initDataPtr) AampDRMSession manager has two static AampDrmSession objects. This method will return the existing DRM session pointer if any one of these static DRM session objects are created against requested keyId. Binds the oldest DRM Session with new keyId if no matching keyId is found in existing sessions.
Definition at line 875 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::getLicense | ( | AampLicenseRequest & | licRequest, |
int32_t * | httpError, | ||
MediaType | streamType, | ||
PrivateInstanceAAMP * | aamp, | ||
bool | isContentMetadataAvailable = false , |
||
std::string | licenseProxy = "" |
||
) |
Get DRM license key from DRM server.
[in] | licRequest | - License request details (URL, headers etc.) |
[out] | httpError | - Gets updated with http error; default -1. |
[in] | isContentMetadataAvailable | - Flag to indicate whether MSO specific headers are to be used. |
[in] | licenseProxy | - Proxy to use for license requests. |
Definition at line 670 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::IsKeyIdUsable | ( | std::vector< uint8_t > | keyIdArray | ) |
Get DRM license key from DRM server.
[in] | keyIdArray | - key Id extracted from pssh data |
Definition at line 482 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::clearSessionData | ( | ) |
Clean up the memory used by session variables.
Definition at line 155 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::clearAccessToken | ( | ) |
Clean up the memory for accessToken.
Definition at line 244 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::clearFailedKeyIds | ( | ) |
AampDRMSessionManager::clearDrmSession | ( | bool | forceClearSession = false | ) |
Clean up the Session Data if license key acquisition failed or if LicenseCaching is false.
forceClearSession | clear the drm session irrespective of failed keys if LicenseCaching is false. |
Definition at line 257 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::setSessionMgrState | ( | SessionMgrState | state | ) |
Set Session manager state.
state | session manager sate to be set |
Definition at line 183 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::getSessionMgrState | ( | ) |
Get Session manager state.
Definition at line 191 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::setCurlAbort | ( | bool | isAbort | ) |
Set Session abort flag.
isAbort | bool flag to curl abort |
Definition at line 199 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::getCurlAbort | ( | void | ) |
Get Session abort flag.
Definition at line 206 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::setLicenseRequestAbort | ( | bool | isAbort | ) |
Get Session abort flag.
isAbort | bool flag to curl abort |
Definition at line 213 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::getAccessToken | ( | int & | tokenLength, |
long & | error_code, | ||
bool | bSslPeerVerify | ||
) |
Get the accessToken from authService.
[out] | tokenLength | - Gets updated with accessToken length. |
Definition at line 388 of file AampDRMSessionManager.cpp.
AampDRMSessionManager::getDrmSession | ( | std::shared_ptr< AampDrmHelper > | drmHelper, |
int & | selectedSlot, | ||
DrmMetaDataEventPtr | eventHandle, | ||
PrivateInstanceAAMP * | aampInstance, | ||
bool | isPrimarySession = false |
||
) |
Create a DRM Session using the Drm Helper Determine a slot in the drmSession Contexts which can be used.
Definition at line 1019 of file AampDRMSessionManager.cpp.