drm/aes/aamp_aes.cpp
/**
 * @brief Wait for key acquisition completion
 *
 * @param[in] timeInMs   Timeout
 * @param[out] err       Error on failure
 */
@brief Wait for key acquisition completion
@param[in] timeInMs   Timeout
@param[out] err       Error on failure
@brief Wait for key acquisition completion @param [ in ] timeInMs Timeout @param [ out ] err Error on failure
void AesDec::WaitForKeyAcquireCompleteUnlocked(int timeInMs, DrmReturn &err )
{
	struct timespec ts;
	struct timeval tv;
	AAMPLOG_INFO( "aamp:waiting for key acquisition to complete,wait time:%d\n",timeInMs );
	gettimeofday(&tv, NULL);
	ts.tv_sec = time(NULL) + timeInMs / 1000;
	ts.tv_nsec = (long)(tv.tv_usec * 1000 + 1000 * 1000 * (timeInMs % 1000));
	ts.tv_sec += ts.tv_nsec / (1000 * 1000 * 1000);
	ts.tv_nsec %= (1000 * 1000 * 1000);
	if(0 != pthread_cond_timedwait(&mCond, &mMutex, &ts)) 
	{
		logprintf("AesDec::%s:%d wait for key acquisition timed out\n", __FUNCTION__, __LINE__);
		err = eDRM_KEY_ACQUSITION_TIMEOUT;
	}
}
void AesDec :: WaitForKeyAcquireCompleteUnlocked ( int timeInMs , DrmReturn & err ) { struct timespec ts ; struct timeval tv ; AAMPLOG_INFO ( " \n " , timeInMs ) ; gettimeofday ( & tv , NULL ) ; ts . tv_sec = time ( NULL ) + timeInMs / 1000 ; ts . tv_nsec = ( long ) ( tv . tv_usec * 1000 + 1000 * 1000 * ( timeInMs % 1000 ) ) ; ts . tv_sec += ts . tv_nsec / ( 1000 * 1000 * 1000 ) ; ts . tv_nsec %= ( 1000 * 1000 * 1000 ) ; if ( 0 != pthread_cond_timedwait ( & mCond , & mMutex , & ts ) ) { logprintf ( " \n " , __FUNCTION__ , __LINE__ ) ; err = eDRM_KEY_ACQUSITION_TIMEOUT ; } }
@brief Wait for key acquisition completion
 @param[in] timeInMs   Timeout
 @param[out] err       Error on failure
@brief Wait for key acquisition completion @param [ in ] timeInMs Timeout @param [ out ] err Error on failure
// block until drm ready