History

Merge pull request #2644 from huili2/parseonly_add_protection

make error consistence for memory fail

huili2 committed 9 years ago

Commit e1a27c92 parents 10bc74b 4c74cc86 files · +56 −35Browse files

Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 6 files). Show all

Unified · Split

codec/decoder/core/src/decoder.cpp+10−7
@@ -474,7 +474,7 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 473 unmodified lines
474/*!474/*!
475 * \brief Open decoder475 * \brief Open decoder
476 */476 */
477int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {477int32_t WelsOpenDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
478 int iRet = ERR_NONE;478 int iRet = ERR_NONE;
479 // function pointers479 // function pointers
480 InitDecFuncs (pCtx, pCtx->uiCpuFlag);480 InitDecFuncs (pCtx, pCtx->uiCpuFlag);
@@ -484,8 +484,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 3 unmodified lines
484 484
485 // static memory485 // static memory
486 iRet = WelsInitStaticMemory (pCtx);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 return iRet;490 return iRet;
491 }
489 492
490#ifdef LONG_TERM_REF493#ifdef LONG_TERM_REF
491 pCtx->bParamSetsLostFlag = true;494 pCtx->bParamSetsLostFlag = true;
@@ -567,7 +570,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 75 unmodified lines
567 }570 }
568 571
569 // open decoder572 // 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 bool bReallocFlag = false;819 bool bReallocFlag = false;
817 iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used820 iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used
818 if (ERR_NONE != iErr) {821 if (ERR_NONE != iErr) {
819 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,822 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
820 "SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");823 "SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");
821 pCtx->iErrorCode = dsOutOfMemory;824 pCtx->iErrorCode |= dsOutOfMemory;
822 return iErr;825 return iErr;
823 }826 }
824 827
825 iErr = InitialDqLayersContext (pCtx, kiPicWidth, kiPicHeight);828 iErr = InitialDqLayersContext (pCtx, kiPicWidth, kiPicHeight);
826 if (ERR_NONE != iErr) {829 if (ERR_NONE != iErr) {
827 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,830 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
828 "SyncPictureResolutionExt()::InitialDqLayersContext--buffer allocated failure.");831 "SyncPictureResolutionExt()::InitialDqLayersContext--buffer allocated failure.");
829 pCtx->iErrorCode = dsOutOfMemory;832 pCtx->iErrorCode |= dsOutOfMemory;
830 }833 }
831#if defined(MEMORY_MONITOR)834#if defined(MEMORY_MONITOR)
832 if (bReallocFlag) {835 if (bReallocFlag) {

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