Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 19 files). Show all
Unified · Split
| @@ -62,6 +62,7 @@ · 61 unmodified lines | ||
| 62 | 62 | #include "cpu.h" |
| 63 | 63 | |
| 64 | 64 | #include "measure_time.h" |
| 65 | +#include "wels_task_management.h" | |
| 65 | 66 | |
| 66 | 67 | #if defined(ENABLE_TRACE_MT) |
| 67 | 68 | #define MT_TRACE_LOG(x, ...) WelsLog(x, __VA_ARGS__) |
| @@ -443,6 +444,10 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 375 unmodified lines | ||
| 443 | 444 | iReturn = WelsMutexInit (&pSmt->mutexSliceNumUpdate); |
| 444 | 445 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 445 | 446 | |
| 447 | + memset(&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof(bool)); | |
| 448 | + iReturn = WelsMutexInit (&pSmt->mutexThreadBsBufferUsage); | |
| 449 | + WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) | |
| 450 | + | |
| 446 | 451 | iReturn = WelsMutexInit (& (*ppCtx)->mutexEncoderError); |
| 447 | 452 | WELS_VERIFY_RETURN_PROC_IF (1, (WELS_THREAD_ERROR_OK != iReturn), FreeMemorySvc (ppCtx)) |
| 448 | 453 | |
| @@ -496,6 +501,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 47 unmodified lines | ||
| 496 | 501 | WelsEventClose (&pSmt->pSliceCodedMasterEvent, ename); |
| 497 | 502 | |
| 498 | 503 | WelsMutexDestroy (&pSmt->mutexSliceNumUpdate); |
| 504 | + WelsMutexDestroy (&pSmt->mutexThreadBsBufferUsage); | |
| 499 | 505 | WelsMutexDestroy (& ((*ppCtx)->mutexEncoderError)); |
| 500 | 506 | |
| 501 | 507 | if (pSmt->pThreadPEncCtx != NULL) { |
| @@ -509,6 +515,7 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 7 unmodified lines | ||
| 509 | 515 | pSmt->pThreadBsBuffer[i] = NULL; |
| 510 | 516 | } |
| 511 | 517 | } |
| 518 | + memset(&pSmt->bThreadBsBufferUsage, 0, MAX_THREADS_NUM * sizeof(bool)); | |
| 512 | 519 | |
| 513 | 520 | pSliceB = (*ppCtx)->pSliceBs; |
| 514 | 521 | iIdx = 0; |