History

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.

Martin Storsjö committed 12 years ago

Commit cf07d611 parent 73cc5861 file · +1 −3Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+1−3
@@ -3280,7 +3280,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 3279 unmodified lines
3280 3280
3281 lwait = WelsMultipleEventsWaitSingleBlocking (iNumThreadsScheduled,3281 lwait = WelsMultipleEventsWaitSingleBlocking (iNumThreadsScheduled,
3282 &pCtx->pSliceThreading->pSliceCodedEvent[0],3282 &pCtx->pSliceThreading->pSliceCodedEvent[0],
3283 2); // 2 ms for one tick3283 (uint32_t) -1);
3284 iEventId = (int32_t) (lwait - WELS_THREAD_ERROR_WAIT_OBJECT_0);3284 iEventId = (int32_t) (lwait - WELS_THREAD_ERROR_WAIT_OBJECT_0);
3285 if (iEventId >= 0 && iEventId < iNumThreadsScheduled) {3285 if (iEventId >= 0 && iEventId < iNumThreadsScheduled) {
3286 if (iIndexOfSliceToBeCoded < iSliceCount) {3286 if (iIndexOfSliceToBeCoded < iSliceCount) {
@@ -3293,8 +3293,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 6 unmodified lines
3293 } else { // no other slices left for coding3293 } else { // no other slices left for coding
3294 -- iNumThreadsRunning;3294 -- iNumThreadsRunning;
3295 }3295 }
3296 } else {
3297 WelsSleep (1);
3298 }3296 }
3299#else3297#else
3300 // TODO for pthread platforms3298 // TODO for pthread platforms

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