History

add protection for decoder and data format

huili2 committed 12 years ago

Commit f8d2ae41 parent 06e56ec4 files · +36 −17Browse files

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

Unified · Split

codec/decoder/plus/src/welsDecoderExt.cpp+11−5
@@ -185,6 +185,7 @@ CWelsDecoder::~CWelsDecoder() { · 184 unmodified lines
185}185}
186 186
187long CWelsDecoder::Initialize (const SDecodingParam* pParam) {187long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
188 int iRet = ERR_NONE;
188 if (m_pWelsTrace == NULL) {189 if (m_pWelsTrace == NULL) {
189 return cmMallocMemeError;190 return cmMallocMemeError;
190 }191 }
@@ -195,9 +196,13 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) { · 4 unmodified lines
195 }196 }
196 197
197 // H.264 decoder initialization,including memory allocation,then open it ready to decode198 // H.264 decoder initialization,including memory allocation,then open it ready to decode
198 InitDecoder();199 iRet = InitDecoder();
200 if (iRet)
201 return iRet;
199 202
200 DecoderConfigParam (m_pDecContext, pParam);203 iRet = DecoderConfigParam (m_pDecContext, pParam);
204 if (iRet)
205 return iRet;
201 206
202 return cmResultSuccess;207 return cmResultSuccess;
203}208}
@@ -226,15 +231,16 @@ void CWelsDecoder::UninitDecoder (void) { · 22 unmodified lines
226}231}
227 232
228// the return value of this function is not suitable, it need report failure info to upper layer.233// the return value of this function is not suitable, it need report failure info to upper layer.
229void CWelsDecoder::InitDecoder (void) {234int32_t CWelsDecoder::InitDecoder (void) {
230 235
231 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder(), openh264 codec version = %s",236 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder(), openh264 codec version = %s",
232 VERSION_NUMBER);237 VERSION_NUMBER);
233 238
234 m_pDecContext = (PWelsDecoderContext)WelsMalloc (sizeof (SWelsDecoderContext), "m_pDecContext");239 m_pDecContext = (PWelsDecoderContext)WelsMalloc (sizeof (SWelsDecoderContext), "m_pDecContext");
240 if (NULL == m_pDecContext)
241 return cmMallocMemeError;
235 242
236 WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);243 return WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
237
238}244}
239 245
240/*246/*

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