ref: 8d5863a170e70683774b565cb8c27cb70fbfa22f
parent: 452fb868c7e1467a7900dd7623ab8a1b3b6e6efc
author: huashi <huashi@cisco.com>
date: Thu Oct 23 13:51:35 EDT 2014
fix bug in set option return value
--- a/codec/encoder/core/inc/extern.h
+++ b/codec/encoder/core/inc/extern.h
@@ -108,7 +108,7 @@
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam);
void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iLayer);
-void WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue);
+int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue);
int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest);
void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarkingFeedback);
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3835,9 +3835,10 @@
return 0;
}
-void WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue) {
+int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue) {
SWelsSvcCodingParam sConfig;
int32_t iNumRefFrame = 1;
+ int32_t iRet = 0;
memcpy (&sConfig, (*ppCtx)->pSvcParam, sizeof (SWelsSvcCodingParam));
sConfig.bEnableLongTermReference = pLTRValue->bEnableLongTermReference;
sConfig.iLTRRefNum = pLTRValue->iLTRRefNum;
@@ -3868,7 +3869,8 @@
WelsLog (pLogCtx, WELS_LOG_INFO, " CWelsH264SVCEncoder::SetOption enable LTR = %d,ltrnum = %d",
sConfig.bEnableLongTermReference, sConfig.iLTRRefNum);
- WelsEncoderParamAdjust (ppCtx, &sConfig);
+ iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
+ return iRet;
}
int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
SFrameBSInfo* pFrameBsInfo,
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -689,7 +689,9 @@
#endif//REC_FRAME_COUNT
/* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */
- WelsEncoderParamAdjust (&m_pEncContext, &sConfig);
+ if (WelsEncoderParamAdjust (&m_pEncContext, &sConfig)) {
+ return cmInitParaError;
+ }
}
break;
case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate
@@ -819,7 +821,9 @@
break;
case ENCODER_OPTION_LTR: {
SLTRConfig* pLTRValue = ((SLTRConfig*) (pOption));
- WelsEncoderApplyLTR (&m_pWelsTrace->m_sLogCtx, &m_pEncContext, pLTRValue);
+ if (WelsEncoderApplyLTR (&m_pWelsTrace->m_sLogCtx, &m_pEncContext, pLTRValue)) {
+ return cmInitParaError;
+ }
}
break;
case ENCODER_OPTION_ENABLE_SSEI: {