This avoids using a separate event just for signalling that a thread has finished running.
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all
Unified · Split
| @@ -2158,11 +2158,10 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 2157 unmodified lines | |||
| 2158 | if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] != NULL) // iThreadIdx is already created successfully | 2158 | if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] != NULL) // iThreadIdx is already created successfully |
| 2159 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]); | 2159 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]); |
| 2160 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]); | 2160 | WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]); |
| 2161 | WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit | ||
| 2161 | ++ iThreadIdx; | 2162 | ++ iThreadIdx; |
| 2162 | } while (iThreadIdx < iThreadCount); | 2163 | } while (iThreadIdx < iThreadCount); |
| 2163 | 2164 | ||
| 2164 | WelsMultipleEventsWaitAllBlocking (iThreadCount, & (*ppCtx)->pSliceThreading->pFinSliceCodingEvent[0]); | ||
| 2165 | |||
| 2166 | } | 2165 | } |
| 2167 | #else | 2166 | #else |
| 2168 | if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) { | 2167 | if ((*ppCtx)->pSliceThreading->pExitEncodeEvent != NULL) { |