History

use pthread_condition instead of semaphores on apple platform

Karina committed 10 years ago

Commit c12b88a1 parent 30328b810 files · +108 −146Browse files

Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 10 files). Show all

Unified · Split

codec/encoder/core/src/slice_multi_threading.cpp+6−7
@@ -361,7 +361,8 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 360 unmodified lines
361 memset (&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof (bool));361 memset (&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof (bool));
362 iReturn = WelsMutexInit (&pSmt->mutexThreadBsBufferUsage);362 iReturn = WelsMutexInit (&pSmt->mutexThreadBsBufferUsage);
363 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))363 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
364 364 iReturn = WelsMutexInit (&pSmt->mutexEvent);
365 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx));
365 iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);366 iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError);
366 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))367 WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx))
367 368
@@ -411,7 +412,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 43 unmodified lines
411 WelsMutexDestroy (&pSmt->mutexSliceNumUpdate);412 WelsMutexDestroy (&pSmt->mutexSliceNumUpdate);
412 WelsMutexDestroy (&pSmt->mutexThreadBsBufferUsage);413 WelsMutexDestroy (&pSmt->mutexThreadBsBufferUsage);
413 WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError));414 WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError));
414 415 WelsMutexDestroy (&pSmt->mutexEvent);
415 if (pSmt->pThreadPEncCtx != NULL) {416 if (pSmt->pThreadPEncCtx != NULL) {
416 pMa->WelsFree (pSmt->pThreadPEncCtx, "pThreadPEncCtx");417 pMa->WelsFree (pSmt->pThreadPEncCtx, "pThreadPEncCtx");
417 pSmt->pThreadPEncCtx = NULL;418 pSmt->pThreadPEncCtx = NULL;
@@ -585,7 +586,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 167 unmodified lines
585 pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx);586 pEventsList[0], pEventsList[1], pEventsList[1], (void*)pEncPEncCtx);
586 iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,587 iWaitRet = WelsMultipleEventsWaitSingleBlocking (iEventCount,
587 &pEventsList[0],588 &pEventsList[0],
588 &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled589 &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx],&pEncPEncCtx->pSliceThreading->mutexEvent); // blocking until at least one event is signalled
589 if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited590 if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
590 //int iLayerIndex = pEncPEncCtx->pOut->iLayerBsIndex;591 //int iLayerIndex = pEncPEncCtx->pOut->iLayerBsIndex;
591 //SFrameBSInfo* pFrameBsInfo = pPrivateData->pFrameBsInfo;592 //SFrameBSInfo* pFrameBsInfo = pPrivateData->pFrameBsInfo;
@@ -877,10 +878,8 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 285 unmodified lines
877 pPriData[iIdx].pFrameBsInfo = pFrameBsInfo;878 pPriData[iIdx].pFrameBsInfo = pFrameBsInfo;
878 pPriData[iIdx].iSliceIndex = iIdx;879 pPriData[iIdx].iSliceIndex = iIdx;
879 SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx);880 SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx);
880 if (pEventsList[iIdx])881 WelsEventSignal (&pEventsList[iIdx]);
881 WelsEventSignal (&pEventsList[iIdx]);882 WelsEventSignal (&pMasterEventsList[iIdx]);
882 if (pMasterEventsList[iIdx])
883 WelsEventSignal (&pMasterEventsList[iIdx]);
884 ++ iIdx;883 ++ iIdx;
885 }884 }
886 885

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t