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
474474 /*!
475475 * \brief Open decoder
476476 */
477−int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) {
477+int32_t WelsOpenDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
478478 int iRet = ERR_NONE;
479479 // function pointers
480480 InitDecFuncs (pCtx, pCtx->uiCpuFlag);
@@ -484,8 +484,11 @@ int32_t WelsOpenDecoder (PWelsDecoderContext pCtx) { · 3 unmodified lines
484484
485485 // static memory
486486 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().");
488490 return iRet;
491+ }
489492
490493 #ifdef LONG_TERM_REF
491494 pCtx->bParamSetsLostFlag = true;
@@ -567,7 +570,7 @@ int32_t WelsInitDecoder (PWelsDecoderContext pCtx, SLogContext* pLogCtx) { · 75 unmodified lines
567570 }
568571
569572 // open decoder
570− return WelsOpenDecoder (pCtx);
573+ return WelsOpenDecoder (pCtx, pLogCtx);
571574 }
572575
573576 /*!
@@ -816,17 +819,17 @@ int32_t SyncPictureResolutionExt (PWelsDecoderContext pCtx, const int32_t kiMbWi · 242 unmodified lines
816819 bool bReallocFlag = false;
817820 iErr = WelsRequestMem (pCtx, kiMbWidth, kiMbHeight, bReallocFlag); // common memory used
818821 if (ERR_NONE != iErr) {
819− WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
822+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
820823 "SyncPictureResolutionExt()::WelsRequestMem--buffer allocated failure.");
821− pCtx->iErrorCode = dsOutOfMemory;
824+ pCtx->iErrorCode |= dsOutOfMemory;
822825 return iErr;
823826 }
824827
825828 iErr = InitialDqLayersContext (pCtx, kiPicWidth, kiPicHeight);
826829 if (ERR_NONE != iErr) {
827− WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
830+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
828831 "SyncPictureResolutionExt()::InitialDqLayersContext--buffer allocated failure.");
829− pCtx->iErrorCode = dsOutOfMemory;
832+ pCtx->iErrorCode |= dsOutOfMemory;
830833 }
831834 #if defined(MEMORY_MONITOR)
832835 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