| 294 | } |
| 295 | |
| 296 | void CWelsDecoder::OpenDecoderThreads() { |
| 297 | if (m_iThreadCount >= 1) { |
| 298 | m_uiDecodeTimeStamp = 0; |
| 299 | CREATE_SEMAPHORE (&m_sIsBusy, m_iThreadCount, m_iThreadCount, NULL); |
| 300 | WelsMutexInit (&m_csDecoder); |
| 301 | CREATE_EVENT (&m_sBufferingEvent, 1, 0, NULL); |
| 302 | SET_EVENT (&m_sBufferingEvent); |
| 303 | CREATE_EVENT (&m_sReleaseBufferEvent, 1, 0, NULL); |
| 304 | SET_EVENT (&m_sReleaseBufferEvent); |
| 305 | for (int32_t i = 0; i < m_iThreadCount; ++i) { |
| 306 | m_pDecThrCtx[i].sThreadInfo.uiThrMaxNum = m_iThreadCount; |
| 307 | m_pDecThrCtx[i].sThreadInfo.uiThrNum = i; |
| 308 | m_pDecThrCtx[i].sThreadInfo.uiThrStackSize = WELS_DEC_MAX_THREAD_STACK_SIZE; |
| 309 | m_pDecThrCtx[i].sThreadInfo.pThrProcMain = pThrProcFrame; |
| 310 | m_pDecThrCtx[i].sThreadInfo.sIsBusy = &m_sIsBusy; |
| 311 | m_pDecThrCtx[i].sThreadInfo.uiCommand = WELS_DEC_THREAD_COMMAND_RUN; |
| 312 | m_pDecThrCtx[i].threadCtxOwner = this; |
| 313 | m_pDecThrCtx[i].kpSrc = NULL; |
| 314 | m_pDecThrCtx[i].kiSrcLen = 0; |
| 315 | m_pDecThrCtx[i].ppDst = NULL; |
| 316 | m_pDecThrCtx[i].pDec = NULL; |
| 317 | CREATE_EVENT (&m_pDecThrCtx[i].sImageReady, 1, 0, NULL); |
| 318 | CREATE_EVENT (&m_pDecThrCtx[i].sSliceDecodeStart, 1, 0, NULL); |
| 319 | CREATE_EVENT (&m_pDecThrCtx[i].sSliceDecodeFinish, 1, 0, NULL); |
| 320 | CREATE_SEMAPHORE (&m_pDecThrCtx[i].sThreadInfo.sIsIdle, 0, 1, NULL); |
| 321 | CREATE_SEMAPHORE (&m_pDecThrCtx[i].sThreadInfo.sIsActivated, 0, 1, NULL); |
| 322 | CREATE_THREAD (&m_pDecThrCtx[i].sThreadInfo.sThrHandle, pThrProcInit, (void*) (& (m_pDecThrCtx[i]))); |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | void CWelsDecoder::CloseDecoderThreads() { |
| 327 | if (m_iThreadCount >= 1) { |
| 328 | SET_EVENT (&m_sReleaseBufferEvent); |
nothing calls this directly
no test coverage detected