Do a blocking wait with WelsMultipleEventsWaitSingleBlocking
There is no point in doing a timed wait here - there's no work that we can do if the wait timed out, and sleeping for 1 ms inbetween doesn't help, it only adds potential extra latency to reacting to threads that need more work to do.
This commit is contained in:
parent
73cc5862ba
commit
cf07d61f06
@ -3280,7 +3280,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou
|
|||||||
|
|
||||||
lwait = WelsMultipleEventsWaitSingleBlocking (iNumThreadsScheduled,
|
lwait = WelsMultipleEventsWaitSingleBlocking (iNumThreadsScheduled,
|
||||||
&pCtx->pSliceThreading->pSliceCodedEvent[0],
|
&pCtx->pSliceThreading->pSliceCodedEvent[0],
|
||||||
2); // 2 ms for one tick
|
(uint32_t) -1);
|
||||||
iEventId = (int32_t) (lwait - WELS_THREAD_ERROR_WAIT_OBJECT_0);
|
iEventId = (int32_t) (lwait - WELS_THREAD_ERROR_WAIT_OBJECT_0);
|
||||||
if (iEventId >= 0 && iEventId < iNumThreadsScheduled) {
|
if (iEventId >= 0 && iEventId < iNumThreadsScheduled) {
|
||||||
if (iIndexOfSliceToBeCoded < iSliceCount) {
|
if (iIndexOfSliceToBeCoded < iSliceCount) {
|
||||||
@ -3293,8 +3293,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou
|
|||||||
} else { // no other slices left for coding
|
} else { // no other slices left for coding
|
||||||
-- iNumThreadsRunning;
|
-- iNumThreadsRunning;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
WelsSleep (1);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// TODO for pthread platforms
|
// TODO for pthread platforms
|
||||||
|
Loading…
x
Reference in New Issue
Block a user