History

modify return value check inside decoder

unknown committed 10 years ago

Commit 9cb4f4e1 parent 13586a311 files · +216 −197Browse files

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

Unified · Split

codec/decoder/core/src/decoder.cpp+16−16
@@ -64,7 +64,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons · 63 unmodified lines
6464 PPicBuff pPicBuf = NULL;
6565 int32_t iPicIdx = 0;
6666 if (kiSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
67− return 1;
67+ return ERR_INFO_INVALID_PARAM;
6868 }
6969
7070 CMemoryAlign* pMa = pCtx->pMemAlign;
@@ -72,7 +72,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons · 1 unmodified line
7272 pPicBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
7373
7474 if (NULL == pPicBuf) {
75− return 1;
75+ return ERR_INFO_OUT_OF_MEMORY;
7676 }
7777
7878 pPicBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiSize * sizeof (PPicture), "PPicture*");
@@ -80,7 +80,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons · 1 unmodified line
8080 if (NULL == pPicBuf->ppPic) {
8181 pPicBuf->iCapacity = 0;
8282 DestroyPicBuff (&pPicBuf, pMa);
83− return 1;
83+ return ERR_INFO_OUT_OF_MEMORY;
8484 }
8585
8686 for (iPicIdx = 0; iPicIdx < kiSize; ++ iPicIdx) {
@@ -89,7 +89,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons · 2 unmodified lines
8989 // init capacity first for free memory
9090 pPicBuf->iCapacity = iPicIdx;
9191 DestroyPicBuff (&pPicBuf, pMa);
92− return 1;
92+ return ERR_INFO_OUT_OF_MEMORY;
9393 }
9494 pPicBuf->ppPic[iPicIdx] = pPic;
9595 }
@@ -99,7 +99,7 @@ static int32_t CreatePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, cons · 3 unmodified lines
9999 pPicBuf->iCurrentIdx = 0;
100100 * ppPicBuf = pPicBuf;
101101
102− return 0;
102+ return ERR_NONE;
103103 }
104104
105105 static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
@@ -108,14 +108,14 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines
108108 PPicBuff pPicNewBuf = NULL;
109109 int32_t iPicIdx = 0;
110110 if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
111− return 1;
111+ return ERR_INFO_INVALID_PARAM;
112112 }
113113
114114 CMemoryAlign* pMa = pCtx->pMemAlign;
115115 pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
116116
117117 if (NULL == pPicNewBuf) {
118− return 1;
118+ return ERR_INFO_OUT_OF_MEMORY;
119119 }
120120
121121 pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
@@ -123,7 +123,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 1 unmodified line
123123 if (NULL == pPicNewBuf->ppPic) {
124124 pPicNewBuf->iCapacity = 0;
125125 DestroyPicBuff (&pPicNewBuf, pMa);
126− return 1;
126+ return ERR_INFO_OUT_OF_MEMORY;
127127 }
128128
129129 // increase new PicBuf
@@ -133,7 +133,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 3 unmodified lines
133133 // Set maximum capacity as the new malloc memory at the tail
134134 pPicNewBuf->iCapacity = iPicIdx;
135135 DestroyPicBuff (&pPicNewBuf, pMa);
136− return 1;
136+ return ERR_INFO_OUT_OF_MEMORY;
137137 }
138138 pPicNewBuf->ppPic[iPicIdx] = pPic;
139139 }
@@ -162,7 +162,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 22 unmodified lines
162162 pPicOldBuf->iCurrentIdx = 0;
163163 pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
164164 pPicOldBuf = NULL;
165− return 0;
165+ return ERR_NONE;
166166 }
167167
168168 static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
@@ -171,7 +171,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 2 unmodified lines
171171 PPicBuff pPicNewBuf = NULL;
172172 int32_t iPicIdx = 0;
173173 if (kiOldSize <= 0 || kiNewSize <= 0 || kiPicWidth <= 0 || kiPicHeight <= 0) {
174− return 1;
174+ return ERR_INFO_INVALID_PARAM;
175175 }
176176
177177 CMemoryAlign* pMa = pCtx->pMemAlign;
@@ -179,7 +179,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 1 unmodified line
179179 pPicNewBuf = (PPicBuff)pMa->WelsMallocz (sizeof (SPicBuff), "PPicBuff");
180180
181181 if (NULL == pPicNewBuf) {
182− return 1;
182+ return ERR_INFO_OUT_OF_MEMORY;
183183 }
184184
185185 pPicNewBuf->ppPic = (PPicture*)pMa->WelsMallocz (kiNewSize * sizeof (PPicture), "PPicture*");
@@ -187,7 +187,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 1 unmodified line
187187 if (NULL == pPicNewBuf->ppPic) {
188188 pPicNewBuf->iCapacity = 0;
189189 DestroyPicBuff (&pPicNewBuf, pMa);
190− return 1;
190+ return ERR_INFO_OUT_OF_MEMORY;
191191 }
192192
193193 int32_t iPrevPicIdx = -1;
@@ -239,7 +239,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 45 unmodified lines
239239 pMa->WelsFree (pPicOldBuf, "pPicOldBuf");
240240 pPicOldBuf = NULL;
241241
242− return 0;
242+ return ERR_NONE;
243243 }
244244
245245 void DestroyPicBuff (PPicBuff* ppPicBuf, CMemoryAlign* pMa) {
@@ -523,7 +523,7 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) { · 277 unmodified lines
523523 */
524524 int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpParam) {
525525 if (NULL == pCtx || NULL == kpParam)
526− return 1;
526+ return ERR_INFO_INVALID_PARAM;
527527
528528 memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
529529 if ((pCtx->pParam->eEcActiveIdc > ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
@@ -549,7 +549,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa · 19 unmodified lines
549549
550550 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "eVideoType: %d", pCtx->eVideoType);
551551
552− return 0;
552+ return ERR_NONE;
553553 }
554554
555555 /*!

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