| 94 | } |
| 95 | |
| 96 | WelsErrorType CWelsTaskManageBase::Init (sWelsEncCtx* pEncCtx) { |
| 97 | m_pEncCtx = pEncCtx; |
| 98 | m_iThreadNum = m_pEncCtx->pSvcParam->iMultipleThreadIdc; |
| 99 | |
| 100 | int32_t iReturn = ENC_RETURN_SUCCESS; |
| 101 | //fprintf(stdout, "m_pThreadPool = &(CWelsThreadPool::GetInstance, this=%x\n", this); |
| 102 | iReturn = CWelsThreadPool::SetThreadNum (m_iThreadNum); |
| 103 | m_pThreadPool = (CWelsThreadPool::AddReference()); |
| 104 | if ((iReturn != ENC_RETURN_SUCCESS) && pEncCtx) { |
| 105 | int32_t current_thread_num = m_pThreadPool->GetThreadNum(); |
| 106 | if (m_iThreadNum != current_thread_num) { |
| 107 | WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_WARNING, |
| 108 | "Set Thread Num to %d did not succeed, current thread num in use: %d", |
| 109 | m_iThreadNum, current_thread_num); |
| 110 | } |
| 111 | } |
| 112 | WELS_VERIFY_RETURN_IF (ENC_RETURN_MEMALLOCERR, NULL == m_pThreadPool) |
| 113 | //fprintf(stdout, "m_pThreadPool = &(CWelsThreadPool::GetInstance3\n"); |
| 114 | |
| 115 | iReturn = ENC_RETURN_SUCCESS; |
| 116 | for (int32_t iDid = 0; iDid < MAX_DEPENDENCY_LAYER; iDid++) { |
| 117 | m_pcAllTaskList[CWelsBaseTask::WELS_ENC_TASK_ENCODING][iDid] = m_cEncodingTaskList[iDid]; |
| 118 | m_pcAllTaskList[CWelsBaseTask::WELS_ENC_TASK_UPDATEMBMAP][iDid] = m_cPreEncodingTaskList[iDid]; |
| 119 | iReturn |= CreateTasks (pEncCtx, iDid); |
| 120 | } |
| 121 | |
| 122 | //fprintf(stdout, "CWelsTaskManageBase Init m_iThreadNum %d m_iCurrentTaskNum %d pEncCtx->iMaxSliceCount %d\n", m_iThreadNum, m_iCurrentTaskNum, pEncCtx->iMaxSliceCount); |
| 123 | return iReturn; |
| 124 | } |
| 125 | |
| 126 | void CWelsTaskManageBase::Uninit() { |
| 127 | DestroyTasks(); |
no test coverage detected