Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 2 files). Show all
Unified · Split
| @@ -320,20 +320,21 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara · 319 unmodified lines | ||
| 320 | 320 | "pThreadHandles"); |
| 321 | 321 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pThreadHandles), FreeMemorySvc (ppCtx)) |
| 322 | 322 | |
| 323 | −#ifdef _WIN32 | |
| 324 | 323 | pSmt->pSliceCodedEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pSliceCodedEvent"); |
| 325 | 324 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceCodedEvent), FreeMemorySvc (ppCtx)) |
| 326 | 325 | pSmt->pReadySliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, |
| 327 | 326 | "pReadySliceCodingEvent"); |
| 328 | 327 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pReadySliceCodingEvent), FreeMemorySvc (ppCtx)) |
| 329 | − pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | |
| 330 | − WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | |
| 331 | 328 | |
| 332 | 329 | pSmt->pUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pUpdateMbListEvent"); |
| 333 | 330 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 334 | 331 | pSmt->pFinUpdateMbListEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinUpdateMbListEvent"); |
| 335 | 332 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinUpdateMbListEvent), FreeMemorySvc (ppCtx)) |
| 336 | 333 | |
| 334 | +#ifdef _WIN32 | |
| 335 | + pSmt->pFinSliceCodingEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pFinSliceCodingEvent"); | |
| 336 | + WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pFinSliceCodingEvent), FreeMemorySvc (ppCtx)) | |
| 337 | + | |
| 337 | 338 | pSmt->pExitEncodeEvent = (WELS_EVENT*)pMa->WelsMalloc (sizeof (WELS_EVENT) * iThreadNum, "pExitEncodeEvent"); |
| 338 | 339 | WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pExitEncodeEvent), FreeMemorySvc (ppCtx)) |
| 339 | 340 | #else |
| @@ -514,11 +515,6 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 174 unmodified lines | ||
| 514 | 515 | ++ iIdx; |
| 515 | 516 | } |
| 516 | 517 | |
| 517 | −#ifdef _WIN32 | |
| 518 | − if (pSmt->pExitEncodeEvent != NULL) { | |
| 519 | − pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); | |
| 520 | − pSmt->pExitEncodeEvent = NULL; | |
| 521 | − } | |
| 522 | 518 | if (pSmt->pSliceCodedEvent != NULL) { |
| 523 | 519 | pMa->WelsFree (pSmt->pSliceCodedEvent, "pSliceCodedEvent"); |
| 524 | 520 | pSmt->pSliceCodedEvent = NULL; |
| @@ -527,6 +523,11 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 2 unmodified lines | ||
| 527 | 523 | pMa->WelsFree (pSmt->pReadySliceCodingEvent, "pReadySliceCodingEvent"); |
| 528 | 524 | pSmt->pReadySliceCodingEvent = NULL; |
| 529 | 525 | } |
| 526 | +#ifdef _WIN32 | |
| 527 | + if (pSmt->pExitEncodeEvent != NULL) { | |
| 528 | + pMa->WelsFree (pSmt->pExitEncodeEvent, "pExitEncodeEvent"); | |
| 529 | + pSmt->pExitEncodeEvent = NULL; | |
| 530 | + } | |
| 530 | 531 | if (pSmt->pFinSliceCodingEvent != NULL) { |
| 531 | 532 | pMa->WelsFree (pSmt->pFinSliceCodingEvent, "pFinSliceCodingEvent"); |
| 532 | 533 | pSmt->pFinSliceCodingEvent = NULL; |
| @@ -573,7 +574,6 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 40 unmodified lines | ||
| 573 | 574 | ++ iIdx; |
| 574 | 575 | } |
| 575 | 576 | |
| 576 | −#ifdef _WIN32 | |
| 577 | 577 | if (pSmt->pUpdateMbListEvent != NULL) { |
| 578 | 578 | pMa->WelsFree (pSmt->pUpdateMbListEvent, "pUpdateMbListEvent"); |
| 579 | 579 | pSmt->pUpdateMbListEvent = NULL; |
| @@ -582,12 +582,12 @@ void ReleaseMtResource (sWelsEncCtx** ppCtx) { · 2 unmodified lines | ||
| 582 | 582 | pMa->WelsFree (pSmt->pFinUpdateMbListEvent, "pFinUpdateMbListEvent"); |
| 583 | 583 | pSmt->pFinUpdateMbListEvent = NULL; |
| 584 | 584 | } |
| 585 | −#else | |
| 585 | +#ifndef _WIN32 | |
| 586 | 586 | if (pSmt->pUpdateMbListThrdHandles) { |
| 587 | 587 | pMa->WelsFree (pSmt->pUpdateMbListThrdHandles, "pUpdateMbListThrdHandles"); |
| 588 | 588 | pSmt->pUpdateMbListThrdHandles = NULL; |
| 589 | 589 | } |
| 590 | −#endif//_WIN32 | |
| 590 | +#endif//!_WIN32 | |
| 591 | 591 | |
| 592 | 592 | #ifdef MT_DEBUG |
| 593 | 593 | // file handle for debug |