make error consistence for memory fail
Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 6 files). Show all
Unified · Split
| @@ -474,7 +474,7 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 473 unmodified lines | ||
| 474 | 474 | /*! |
| 475 | 475 | * \brief Open decoder |
| 476 | 476 | */ |
| 477 | −int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { | |
| 477 | +int32_t WelsOpenDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { | |
| 478 | 478 | int iRet = ERR_NONE; |
| 479 | 479 | // function pointers |
| 480 | 480 | InitDecFuncs (pCtx, pCtx->uiCpuFlag); |
| @@ -484,8 +484,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 484 | 484 | |
| 485 | 485 | // static memory |
| 486 | 486 | iRet = WelsInitStaticMemory (pCtx); |
| 487 | − if (ERR_NONE != iRet) | |
| 487 | + if (ERR_NONE != iRet) { | |
| 488 | + pCtx->iErrorCode |= dsOutOfMemory; | |
| 489 | + WelsLog (pLogCtx, WELS_LOG_ERROR, "WelsInitStaticMemory() failed in WelsOpenDecoder()."); | |
| 488 | 490 | return iRet; |
| 491 | + } | |
| 489 | 492 | |
| 490 | 493 | #ifdef LONG_TERM_REF |
| 491 | 494 | pCtx->bParamSetsLostFlag = true; |
| @@ -567,7 +570,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 75 unmodified lines | ||
| 567 | 570 | } |
| 568 | 571 | |
| 569 | 572 | // open decoder |
| 570 | − return WelsOpenDecoder (pCtx); | |
| 573 | + return WelsOpenDecoder (pCtx, pLogCtx); | |
| 571 | 574 | } |
| 572 | 575 | |
| 573 | 576 | /*! |
| @@ -816,17 +819,17 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi · 242 unmodified lines | ||
| 816 | 819 | bool bReallocFlag = false; |
| 817 | 820 | iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used |
| 818 | 821 | if (ERR_NONE != iErr) { |
| 819 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 822 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 820 | 823 | "SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure."); |
| 821 | − pCtx->iErrorCode = dsOutOfMemory; | |
| 824 | + pCtx->iErrorCode |= dsOutOfMemory; | |
| 822 | 825 | return iErr; |
| 823 | 826 | } |
| 824 | 827 | |
| 825 | 828 | iErr = InitialDqLayersContext (pCtx, kiPicWidth, kiPicHeight); |
| 826 | 829 | if (ERR_NONE != iErr) { |
| 827 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | |
| 830 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | |
| 828 | 831 | "SyncPictureResolutionExt()::InitialDqLayersContext--buffer allocated failure."); |
| 829 | − pCtx->iErrorCode = dsOutOfMemory; | |
| 832 | + pCtx->iErrorCode |= dsOutOfMemory; | |
| 830 | 833 | } |
| 831 | 834 | #if defined(MEMORY_MONITOR) |
| 832 | 835 | if (bReallocFlag) { |