ref: cf07d61f0622a886d657abf3e694d6cc1043bf89
parent: 73cc5862bad6518709f9a74f194d008fd2150734
author: Martin Storsjö <[email protected]>
date: Mon Mar 3 11:18:31 EST 2014
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.
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3280,7 +3280,7 @@
lwait = WelsMultipleEventsWaitSingleBlocking (iNumThreadsScheduled,
&pCtx->pSliceThreading->pSliceCodedEvent[0],
- 2); // 2 ms for one tick
+ (uint32_t) -1);
iEventId = (int32_t) (lwait - WELS_THREAD_ERROR_WAIT_OBJECT_0);
if (iEventId >= 0 && iEventId < iNumThreadsScheduled) {
if (iIndexOfSliceToBeCoded < iSliceCount) {
@@ -3293,8 +3293,6 @@
} else { // no other slices left for coding
-- iNumThreadsRunning;
}
- } else {
- WelsSleep (1);
}
#else
// TODO for pthread platforms