drm/aes/aamp_aes.cpp
/**
 * @brief Acquire drm key from URI
 */
@brief Acquire drm key from URI
@brief Acquire drm key from URI
void AesDec::AcquireKey()
{
	char tempEffectiveUrl[MAX_URI_LENGTH];
	long http_error;
	if (aamp_pthread_setname(pthread_self(), "aampAesKey"))
	{
		logprintf("%s:%d: pthread_setname_np failed\n", __FUNCTION__, __LINE__);
	}
	logprintf("%s:%d: Key acquisition start uri = %s\n", __FUNCTION__, __LINE__, mDrmInfo.uri);
	bool fetched = mpAamp->GetFile(mDrmInfo.uri, &mAesKeyBuf, tempEffectiveUrl, &http_error, NULL, mCurlInstance, true, eMEDIATYPE_LICENCE);
	if (fetched)
	{
		if (AES_128_KEY_LEN_BYTES == mAesKeyBuf.len)
		{
			logprintf("%s:%d: Key fetch success len = %d\n", __FUNCTION__, __LINE__, (int)mAesKeyBuf.len);
			mDrmState = eDRM_KEY_ACQUIRED;
			PrivateInstanceAAMP::AddIdleTask(drmSignalKeyAquired, this);
		}
		else
		{
			logprintf("%s:%d: Error Key fetch - size %d\n", __FUNCTION__, __LINE__, (int)mAesKeyBuf.len);
			mDrmState = eDRM_KEY_FAILED;
			aamp_Free(&mAesKeyBuf.ptr);
		}
	}
	else
	{
		mDrmState = eDRM_KEY_FAILED;
		logprintf("%s:%d: Key fetch failed\n", __FUNCTION__, __LINE__);
	}
	if(eDRM_KEY_FAILED == mDrmState)
	{
		aamp_Free(&mAesKeyBuf.ptr);
		NotifyDRMError(AAMP_TUNE_FAILED_TO_GET_KEYID);
	}
}
void AesDec :: AcquireKey ( ) { char tempEffectiveUrl [ MAX_URI_LENGTH ] ; long http_error ; if ( aamp_pthread_setname ( pthread_self ( ) , " " ) ) { logprintf ( " \n " , __FUNCTION__ , __LINE__ ) ; } logprintf ( " \n " , __FUNCTION__ , __LINE__ , mDrmInfo . uri ) ; bool fetched = mpAamp -> GetFile ( mDrmInfo . uri , & mAesKeyBuf , tempEffectiveUrl , & http_error , NULL , mCurlInstance , true , eMEDIATYPE_LICENCE ) ; if ( fetched ) { if ( AES_128_KEY_LEN_BYTES == mAesKeyBuf . len ) { logprintf ( " \n " , __FUNCTION__ , __LINE__ , ( int ) mAesKeyBuf . len ) ; mDrmState = eDRM_KEY_ACQUIRED ; PrivateInstanceAAMP :: AddIdleTask ( drmSignalKeyAquired , this ) ; } else { logprintf ( " \n " , __FUNCTION__ , __LINE__ , ( int ) mAesKeyBuf . len ) ; mDrmState = eDRM_KEY_FAILED ; aamp_Free ( & mAesKeyBuf . ptr ) ; } } else { mDrmState = eDRM_KEY_FAILED ; logprintf ( " \n " , __FUNCTION__ , __LINE__ ) ; } if ( eDRM_KEY_FAILED == mDrmState ) { aamp_Free ( & mAesKeyBuf . ptr ) ; NotifyDRMError ( AAMP_TUNE_FAILED_TO_GET_KEYID ) ; } }
@brief Acquire drm key from URI
@brief Acquire drm key from URI