shithub: openh264

Download patch

ref: 273e1227a575a52aa417926366fa37e84940aa91
parent: 43c62d06ebc993bd151ca45db76581e57a6e601f
parent: 8d5863a170e70683774b565cb8c27cb70fbfa22f
author: sijchen <[email protected]>
date: Fri Oct 24 05:00:56 EDT 2014

Merge pull request #1440 from shihuade/APIUTV1.4

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
@@ -3850,9 +3850,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;
@@ -3883,7 +3884,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
@@ -750,7 +750,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
@@ -880,7 +882,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: {