History

add dec memory check

huili2 committed 11 years ago

Commit 3cb417f1 parent 9ecc67112 files · +196 −141Browse files

Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 12 files). Show all

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+16−5
@@ -219,11 +219,19 @@ void CWelsDecoder::UninitDecoder (void) { · 218 unmodified lines
219 if (NULL == m_pDecContext)219 if (NULL == m_pDecContext)
220 return;220 return;
221 221
222 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.",222 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::UninitDecoder(), openh264 codec version = %s.",
223 VERSION_NUMBER);223 VERSION_NUMBER);
224 224
225 WelsEndDecoder (m_pDecContext);225 WelsEndDecoder (m_pDecContext);
226 226
227 if (m_pDecContext->pMemAlign != NULL) {
228 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
229 "CWelsDecoder::UninitDecoder(), verify memory usage (%d bytes) after free..",
230 m_pDecContext->pMemAlign->WelsGetMemoryUsage());
231 delete m_pDecContext->pMemAlign;
232 m_pDecContext->pMemAlign = NULL;
233 }
234
227 if (NULL != m_pDecContext) {235 if (NULL != m_pDecContext) {
228 WelsFree (m_pDecContext, "m_pDecContext");236 WelsFree (m_pDecContext, "m_pDecContext");
229 237
@@ -243,6 +251,9 @@ int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) { · 13 unmodified lines
243 m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext");251 m_pDecContext = (PWelsDecoderContext)WelsMallocz (sizeof (SWelsDecoderContext), "m_pDecContext");
244 if (NULL == m_pDecContext)252 if (NULL == m_pDecContext)
245 return cmMallocMemeError;253 return cmMallocMemeError;
254 int32_t iCacheLineSize = 16; // on chip cache line size in byte
255 m_pDecContext->pMemAlign = new CMemoryAlign (iCacheLineSize);
256 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == m_pDecContext->pMemAlign), UninitDecoder())
246 257
247 return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx);258 return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx);
248}259}
@@ -409,10 +420,10 @@ DECODING_STATE CWelsDecoder::DecodeFrameNoDelay (const unsigned char* kpSrc, · 160 unmodified lines
409 //ppTmpDst[2] = ppDst[2];420 //ppTmpDst[2] = ppDst[2];
410 iRet |= DecodeFrame2 (NULL, 0, ppDst, pDstInfo);421 iRet |= DecodeFrame2 (NULL, 0, ppDst, pDstInfo);
411 //if ((pDstInfo->iBufferStatus == 0) && (sTmpBufferInfo.iBufferStatus == 1)) {422 //if ((pDstInfo->iBufferStatus == 0) && (sTmpBufferInfo.iBufferStatus == 1)) {
412 //memcpy (pDstInfo, &sTmpBufferInfo, sizeof (SBufferInfo));423 //memcpy (pDstInfo, &sTmpBufferInfo, sizeof (SBufferInfo));
413 //ppDst[0] = ppTmpDst[0];424 //ppDst[0] = ppTmpDst[0];
414 //ppDst[1] = ppTmpDst[1];425 //ppDst[1] = ppTmpDst[1];
415 //ppDst[2] = ppTmpDst[2];426 //ppDst[2] = ppTmpDst[2];
416 //}427 //}
417 428
418 return (DECODING_STATE) iRet;429 return (DECODING_STATE) iRet;

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