add verification on return value

This commit is contained in:
ruil2 2014-02-28 14:31:17 +08:00
parent 3d47b7847d
commit 823b3b6820

View File

@ -406,8 +406,14 @@ int CWelsH264SVCEncoder::Initialize2 (SWelsSvcCodingParam* pCfg) {
m_iSrcListSize = 0;
return cmMallocMemeError;
}
InitPic (m_pSrcPicList[i], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight);
}
if(InitPic (m_pSrcPicList[i], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight))
{
WelsLog (m_pEncContext, WELS_LOG_ERROR,
"CWelsH264SVCEncoder::Initialize(), InitPic Failed iColorspace= 0x%x\n", iColorspace);
Uninitialize();
return cmInitParaError;
}
}
if (WelsInitEncoderExt (&m_pEncContext, pCfg)) {
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.\n");
@ -711,7 +717,13 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
continue;
}
InitPic (m_pSrcPicList[iPicIdx], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight);
if(InitPic (m_pSrcPicList[iPicIdx], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight))
{
WelsLog (m_pEncContext, WELS_LOG_INFO,
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, iColorspace= 0x%x\n",
iColorspace);
return cmInitParaError;
}
}
m_iCspInternal = iColorspace;
#ifdef REC_FRAME_COUNT
@ -810,7 +822,13 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
}
if (m_iCspInternal != iInputColorspace || m_iMaxPicWidth != iTargetWidth
|| m_iMaxPicHeight != iTargetHeight) { // for color space due to changed
InitPic (m_pSrcPicList[0], iInputColorspace, iTargetWidth, iTargetHeight);
if(InitPic (m_pSrcPicList[0], iInputColorspace, iTargetWidth, iTargetHeight))
{
WelsLog (m_pEncContext, WELS_LOG_INFO,
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iInputColorspace= 0x%x\n",
iInputColorspace);
return cmInitParaError;
}
m_iMaxPicWidth = iTargetWidth;
m_iMaxPicHeight = iTargetHeight;
m_iCspInternal = iInputColorspace;