From 933c4777173271fb81b81fd86921fea403b0e802 Mon Sep 17 00:00:00 2001
From: huili2 <huili2@cisco.com>
Date: Wed, 23 Jul 2014 02:33:00 -0700
Subject: [PATCH] modify EC API name and remove useless flag

---
 codec/api/svc/codec_app_def.h                 |  2 +-
 codec/console/dec/src/h264dec.cpp             | 10 +++++-----
 codec/decoder/core/inc/decoder_context.h      |  3 +--
 codec/decoder/core/src/au_parser.cpp          | 11 ++++++-----
 codec/decoder/core/src/decoder.cpp            | 16 ++++++++--------
 codec/decoder/core/src/decoder_core.cpp       | 16 ++++++++--------
 codec/decoder/core/src/error_concealment.cpp  | 12 ++++++------
 codec/decoder/core/src/manage_dec_ref.cpp     |  8 ++++----
 codec/decoder/core/src/parse_mb_syn_cavlc.cpp |  8 ++++----
 codec/decoder/plus/src/welsDecoderExt.cpp     |  9 +++++----
 module/gmp-openh264.cpp                       |  2 +-
 test/api/BaseDecoderTest.cpp                  |  2 +-
 test/decoder/DecUT_ErrorConcealment.cpp       |  4 ++--
 13 files changed, 52 insertions(+), 51 deletions(-)

diff --git a/codec/api/svc/codec_app_def.h b/codec/api/svc/codec_app_def.h
index 3370a5d2..3250c92f 100644
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -359,7 +359,7 @@ typedef struct TagSVCDecodingParam {
   unsigned int	uiCpuLoad;		// CPU load
   unsigned char	uiTargetDqLayer;	// Setting target dq layer id
 
-  unsigned char	uiEcActiveFlag;		// Whether active error concealment feature in decoder
+  ERROR_CON_IDC eEcActiveIdc;		// Whether active error concealment feature in decoder
 
   SVideoProperty   sVideoProperty;
 } SDecodingParam, *PDecodingParam;
diff --git a/codec/console/dec/src/h264dec.cpp b/codec/console/dec/src/h264dec.cpp
index ce09e809..c2432644 100644
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -198,7 +198,7 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
     pDecoder->GetOption (DECODER_OPTION_VCL_NAL, &iFeedbackVclNalInAu);
     int32_t iFeedbackTidInAu;
     pDecoder->GetOption (DECODER_OPTION_TEMPORAL_ID, &iFeedbackTidInAu);
-    int32_t iErrorConMethod = ERROR_CON_SLICE_COPY;
+    int32_t iErrorConMethod = (int32_t) ERROR_CON_SLICE_COPY;
     pDecoder->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iErrorConMethod);
 //~end for
 
@@ -350,8 +350,8 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
             sDecParam.uiTargetDqLayer	= (uint8_t)atol (strTag[1].c_str());
           } else if (strTag[0].compare ("OutColorFormat") == 0) {
             sDecParam.iOutputColorFormat = atoi (strTag[1].c_str());
-          } else if (strTag[0].compare ("ErrorConcealmentFlag") == 0) {
-            sDecParam.uiEcActiveFlag	= (uint8_t)atol (strTag[1].c_str());
+          } else if (strTag[0].compare ("ErrorConcealmentIdc") == 0) {
+            sDecParam.eEcActiveIdc = (ERROR_CON_IDC)atol (strTag[1].c_str());
           } else if (strTag[0].compare ("CPULoad") == 0) {
             sDecParam.uiCpuLoad	= (uint32_t)atol (strTag[1].c_str());
           } else if (strTag[0].compare ("VideoBitstreamType") == 0) {
@@ -368,7 +368,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
       strInputFile	= pArgV[1];
       sDecParam.iOutputColorFormat          = videoFormatI420;
       sDecParam.uiTargetDqLayer	          = (uint8_t) - 1;
-      sDecParam.uiEcActiveFlag	          = 1;
+      sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
       sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
     }
   } else { //iArgC > 2
@@ -376,7 +376,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
     strOutputFile	= pArgV[2];
     sDecParam.iOutputColorFormat	= videoFormatI420;
     sDecParam.uiTargetDqLayer	= (uint8_t) - 1;
-    sDecParam.uiEcActiveFlag	= 1;
+    sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
     sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
     if (iArgC > 3) {
       for (int i = 3; i < iArgC; i++) {
diff --git a/codec/decoder/core/inc/decoder_context.h b/codec/decoder/core/inc/decoder_context.h
index be405b1d..61f1c60d 100644
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -176,7 +176,6 @@ uint32_t			uiCpuFlag;			// CPU compatibility detected
 
 int32_t				iOutputColorFormat;		// color space format to be outputed
 VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection.
-bool				bErrorResilienceFlag;		// error resilience flag
 bool				bHaveGotMemory;	// global memory for decoder context related ever requested?
 
 int32_t				iImgWidthInPixel;	// width of image in pixel reconstruction picture to be output
@@ -287,7 +286,7 @@ uint16_t            uiCurIdrPicId;
 bool       bNewSeqBegin;
 bool       bNextNewSeqBegin;
 int        iOverwriteFlags;
-int32_t iErrorConMethod; //
+ERROR_CON_IDC eErrorConMethod; //
 PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment
 PGetIntraPredFunc pGetI16x16LumaPredFunc[7];		//h264_predict_copy_16x16;
 PGetIntraPredFunc pGetI4x4LumaPredFunc[14];		// h264_predict_4x4_t
diff --git a/codec/decoder/core/src/au_parser.cpp b/codec/decoder/core/src/au_parser.cpp
index a3e7d8b7..37f432b7 100644
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -192,7 +192,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
 
       if (uiAvailNalNum > 0) {
         pCurAu->uiEndPos = uiAvailNalNum - 1;
-        if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
           pCtx->bAuReadyFlag = true;
         }
       }
@@ -211,7 +211,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
 
       if (uiAvailNalNum > 0) {
         pCurAu->uiEndPos = uiAvailNalNum - 1;
-        if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
           pCtx->bAuReadyFlag = true;
         }
       }
@@ -327,7 +327,8 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
       return NULL;
     }
 
-    if ((uiAvailNalNum == 1) && CheckNextAuNewSeq (pCtx, pCurNal, pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps)) {
+    if ((uiAvailNalNum == 1)
+        && CheckNextAuNewSeq (pCtx, pCurNal, pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps)) {
       ResetActiveSPSForEachLayer (pCtx);
     }
     if ((uiAvailNalNum > 1) &&
@@ -508,7 +509,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
       InitBits (pBs, pRbsp, iBitSize);
     iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight);
     if (ERR_NONE != iErr) {	// modified for pSps/pSubsetSps invalid, 12/1/2009
-      if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)
+      if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
         pCtx->iErrorCode |= dsNoParamSets;
       else
         pCtx->iErrorCode |= dsBitstreamError;
@@ -522,7 +523,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
       InitBits (pBs, pRbsp, iBitSize);
     iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs);
     if (ERR_NONE != iErr) {	// modified for pps invalid, 12/1/2009
-      if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)
+      if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
         pCtx->iErrorCode |= dsNoParamSets;
       else
         pCtx->iErrorCode |= dsBitstreamError;
diff --git a/codec/decoder/core/src/decoder.cpp b/codec/decoder/core/src/decoder.cpp
index 56e8edd6..17105f60 100644
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -160,7 +160,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
   pCtx->pPicBuff[LIST_1]		= NULL;
 
   pCtx->bAvcBasedFlag			= true;
-  pCtx->iErrorConMethod = ERROR_CON_SLICE_COPY;
+  pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY;
   pCtx->pPreviousDecodedPictureInDpb = NULL;
 
 }
@@ -332,7 +332,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
 
   memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
   pCtx->iOutputColorFormat	= pCtx->pParam->iOutputColorFormat;
-  pCtx->bErrorResilienceFlag	= pCtx->pParam->uiEcActiveFlag ? true : false;
+  pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
 
   if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType ||
       VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) {
@@ -462,7 +462,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 
           iConsumedBytes = 0;
           pNalPayload	= ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
-          if ((pCtx->iErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
+          if ((pCtx->eErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
             CheckAndDoEC (pCtx, ppDst, pDstBufInfo);
           }
           if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
@@ -477,7 +477,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 #else
               pCtx->bReferenceLostAtT0Flag = true;
 #endif
-              if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
+              if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
                 ResetParameterSetsState (pCtx);
 
               if (dsOutOfMemory & pCtx->iErrorCode) {
@@ -493,7 +493,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 #else
               pCtx->bReferenceLostAtT0Flag = true;
 #endif
-              if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode)) 
+              if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
                 ResetParameterSetsState (pCtx);
             }
             return pCtx->iErrorCode;
@@ -522,7 +522,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 
     iConsumedBytes = 0;
     pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
-    if ((pCtx->iErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
+    if ((pCtx->eErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
       CheckAndDoEC (pCtx, ppDst, pDstBufInfo);
     }
     if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
@@ -537,7 +537,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 #else
         pCtx->bReferenceLostAtT0Flag = true;
 #endif
-        if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
+        if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
           ResetParameterSetsState (pCtx);
         return pCtx->iErrorCode;
       }
@@ -573,7 +573,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
 #else
         pCtx->bReferenceLostAtT0Flag = true;
 #endif
-        if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
+        if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
           ResetParameterSetsState (pCtx);
         return pCtx->iErrorCode;
       }
diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp
index 7be01068..99f2e4a1 100644
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -103,7 +103,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
   ppDst[2] = ppDst[2] + pCtx->sFrameCrop.iTopOffset  * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;
   pDstInfo->iBufferStatus = 1;
 
-  if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete
+  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete
     pDstInfo->iBufferStatus = (int32_t) bFrameCompleteFlag;
 
   if (!bFrameCompleteFlag) {
@@ -129,7 +129,7 @@ inline void    HandleReferenceLostL0 (PWelsDecoderContext pCtx, PNalUnit pCurNal
   if (0 == pCurNal->sNalHeaderExt.uiTemporalId) {
     pCtx->bReferenceLostAtT0Flag = true;
   }
-  if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
 #ifndef LONG_TERM_REF
     if (pCtx->bReferenceLostAtT0Flag) {
       ResetParameterSetsState (pCtx);
@@ -143,7 +143,7 @@ inline void    HandleReferenceLost (PWelsDecoderContext pCtx, PNalUnit pCurNal)
   if ((0 == pCurNal->sNalHeaderExt.uiTemporalId) || (1 == pCurNal->sNalHeaderExt.uiTemporalId)) {
     pCtx->bReferenceLostAtT0Flag = true;
   }
-  if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+  if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
 #ifndef LONG_TERM_REF
     if (pCtx->bReferenceLostAtT0Flag) {
       ResetParameterSetsState (pCtx);
@@ -959,7 +959,7 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) {
       WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
                "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.\n");
       pCtx->iErrorCode |= dsRefLost;
-      if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+      if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
 #ifdef LONG_TERM_REF
         pCtx->iErrorCode |= dsNoParamSets;
         return dsNoParamSets;
@@ -1887,7 +1887,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
                      pSh->iFrameNum);
 
             pCtx->iErrorCode |= dsRefLost;
-            if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+            if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
 #ifdef LONG_TERM_REF
               pCtx->bParamSetsLostFlag = true;
 #else
@@ -1906,7 +1906,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
             WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
                      "reference picture introduced by this frame is lost during transmission! uiTId: %d\n",
                      pNalCur->sNalHeaderExt.uiTemporalId);
-            if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+            if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
               return iRet;
             }
           }
@@ -1920,7 +1920,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
                    "DecodeCurrentAccessUnit() failed (%d) in frame: %d uiDId: %d uiQId: %d\n",
                    iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ);
           HandleReferenceLostL0 (pCtx, pNalCur);
-          if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+          if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
             return iRet;
           }
         }
@@ -1976,7 +1976,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
         pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
         iRet = WelsMarkAsRef (pCtx);
         if (iRet != ERR_NONE) {
-          if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
+          if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
             pCtx->pDec = NULL;
             return iRet;
           }
diff --git a/codec/decoder/core/src/error_concealment.cpp b/codec/decoder/core/src/error_concealment.cpp
index 9a74f6e0..56e182d0 100644
--- a/codec/decoder/core/src/error_concealment.cpp
+++ b/codec/decoder/core/src/error_concealment.cpp
@@ -41,7 +41,7 @@
 namespace WelsDec {
 //Init
 void InitErrorCon (PWelsDecoderContext pCtx) {
-  if (pCtx->iErrorConMethod == ERROR_CON_SLICE_COPY) {
+  if (pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) {
     pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_c;
     pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_c;
 
@@ -64,8 +64,8 @@ void InitErrorCon (PWelsDecoderContext pCtx) {
 
 #if defined(HAVE_NEON_AARCH64)
     if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
-        pCtx->sCopyFunc.pCopyLumaFunc		= WelsCopy16x16_AArch64_neon; //aligned
-        pCtx->sCopyFunc.pCopyChromaFunc		= WelsCopy8x8_AArch64_neon; //aligned
+      pCtx->sCopyFunc.pCopyLumaFunc		= WelsCopy16x16_AArch64_neon; //aligned
+      pCtx->sCopyFunc.pCopyChromaFunc		= WelsCopy8x8_AArch64_neon; //aligned
     }
 #endif //HAVE_NEON_AARCH64
   } //TODO add more methods here
@@ -180,12 +180,12 @@ bool NeedErrorCon (PWelsDecoderContext pCtx) {
 // ImplementErrorConceal
 // Do actual error concealment
 void ImplementErrorCon (PWelsDecoderContext pCtx) {
-  if (ERROR_CON_DISABLE == pCtx->iErrorConMethod) {
+  if (ERROR_CON_DISABLE == pCtx->eErrorConMethod) {
     pCtx->iErrorCode |= dsBitstreamError;
     return;
-  } else if (ERROR_CON_FRAME_COPY == pCtx->iErrorConMethod) {
+  } else if (ERROR_CON_FRAME_COPY == pCtx->eErrorConMethod) {
     DoErrorConFrameCopy (pCtx);
-  } else if (ERROR_CON_SLICE_COPY == pCtx->iErrorConMethod) {
+  } else if (ERROR_CON_SLICE_COPY == pCtx->eErrorConMethod) {
     DoErrorConSliceCopy (pCtx);
   } //TODO add other EC methods here in the future
   pCtx->iErrorCode |= dsDataErrorConcealed;
diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp
index 7c8d3863..93bc5fa0 100644
--- a/codec/decoder/core/src/manage_dec_ref.cpp
+++ b/codec/decoder/core/src/manage_dec_ref.cpp
@@ -112,7 +112,7 @@ int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) {
 
   if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE
       && pCtx->eSliceType != SI_SLICE)) {
-    if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
+    if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
       PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]);
       if (pRef != NULL) {
         memset (pRef->pData[0], 128, pRef->iLinesize[0] * pRef->iHeightInPixel);
@@ -259,7 +259,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
     if (pRefPicMarking->bAdaptiveRefPicMarkingModeFlag) {
       iRet = MMCO (pCtx, pRefPicMarking);
       if (iRet != ERR_NONE) {
-        if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
           iRet = RemainOneBufferInDpbForEC (pCtx);
         } else {
           return iRet;
@@ -274,7 +274,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
     } else {
       iRet = SlidingWindow (pCtx);
       if (iRet != ERR_NONE) {
-        if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
           iRet = RemainOneBufferInDpbForEC (pCtx);
         } else {
           return iRet;
@@ -285,7 +285,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
 
   if (!pCtx->pDec->bIsLongRef) {
     if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) {
-      if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+      if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
         iRet = RemainOneBufferInDpbForEC (pCtx);
       } else {
         return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW;
diff --git a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
index d89a3c93..1c58fe57 100644
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -1003,7 +1003,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
       // Security check: iRefIdx should be in range 0 to num_ref_idx_l0_active_minus1, includsive
       // ref to standard section 7.4.5.1. iRefCount[0] is 1 + num_ref_idx_l0_active_minus1.
       if ((iRefIdx < 0) || (iRefIdx >= iRefCount[0]) || (ppRefPic[iRefIdx] == NULL)) { //error ref_idx
-        if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
           iRefIdx = 0;
           pCtx->iErrorCode |= dsBitstreamError;
         } else {
@@ -1041,7 +1041,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
       WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
       iRefIdx[i] = uiCode;
       if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
-        if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+        if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
           iRefIdx[i] = 0;
           pCtx->iErrorCode |= dsBitstreamError;
         } else {
@@ -1075,7 +1075,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
         WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
         iRefIdx[i] = uiCode;
         if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
-          if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+          if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
             iRefIdx[i] = 0;
             pCtx->iErrorCode |= dsBitstreamError;
           } else {
@@ -1141,7 +1141,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
           WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
           iRefIdx[i] = uiCode;
           if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
-            if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
+            if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
               iRefIdx[i] = 0;
               pCtx->iErrorCode |= dsBitstreamError;
             } else {
diff --git a/codec/decoder/plus/src/welsDecoderExt.cpp b/codec/decoder/plus/src/welsDecoderExt.cpp
index cf78638a..64528fb3 100644
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -211,7 +211,8 @@ void CWelsDecoder::UninitDecoder (void) {
   if (NULL == m_pDecContext)
     return;
 
-  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.", VERSION_NUMBER);
+  WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.",
+           VERSION_NUMBER);
 
   WelsEndDecoder (m_pDecContext);
 
@@ -265,7 +266,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
       iVal = ERROR_CON_SLICE_COPY;
     else
       iVal = * ((int*)pOption); //EC method
-    m_pDecContext->iErrorConMethod = iVal;
+    m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
     return cmResultSuccess;
   } else if (eOptID == DECODER_OPTION_TRACE_LEVEL) {
     if (m_pWelsTrace) {
@@ -339,7 +340,7 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
     * ((int*)pOption) = iVal;
     return cmResultSuccess;
   } else if (DECODER_OPTION_ERROR_CON_IDC == eOptID) {
-    iVal = m_pDecContext->iErrorConMethod;
+    iVal = (int) m_pDecContext->eErrorConMethod;
     * ((int*)pOption) = iVal;
     return cmResultSuccess;
   }
@@ -399,7 +400,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
     //for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.
     if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
         (VIDEO_BITSTREAM_AVC == m_pDecContext->eVideoType)) {
-      if (m_pDecContext->iErrorConMethod == ERROR_CON_DISABLE) {
+      if (m_pDecContext->eErrorConMethod == ERROR_CON_DISABLE) {
 #ifdef LONG_TERM_REF
         m_pDecContext->bParamSetsLostFlag = true;
 #else
diff --git a/module/gmp-openh264.cpp b/module/gmp-openh264.cpp
index d675fd07..bb960472 100644
--- a/module/gmp-openh264.cpp
+++ b/module/gmp-openh264.cpp
@@ -560,7 +560,7 @@ class OpenH264VideoDecoder : public GMPVideoDecoder {
     memset (&param, 0, sizeof (param));
     param.iOutputColorFormat = videoFormatI420;
     param.uiTargetDqLayer = UCHAR_MAX;  // Default value
-    param.uiEcActiveFlag = 1; // Error concealment on.
+    param.eEcActiveIdc = ERROR_CON_SLICE_COPY; // Error concealment on.
     param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
 
     if (decoder_->Initialize (&param)) {
diff --git a/test/api/BaseDecoderTest.cpp b/test/api/BaseDecoderTest.cpp
index c4777116..d57bf264 100644
--- a/test/api/BaseDecoderTest.cpp
+++ b/test/api/BaseDecoderTest.cpp
@@ -55,7 +55,7 @@ void BaseDecoderTest::SetUp() {
   memset (&decParam, 0, sizeof (SDecodingParam));
   decParam.iOutputColorFormat  = videoFormatI420;
   decParam.uiTargetDqLayer = UCHAR_MAX;
-  decParam.uiEcActiveFlag  = 1;
+  decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
   decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
 
   rv = decoder_->Initialize (&decParam);
diff --git a/test/decoder/DecUT_ErrorConcealment.cpp b/test/decoder/DecUT_ErrorConcealment.cpp
index 5ce8c44e..d9477f1e 100644
--- a/test/decoder/DecUT_ErrorConcealment.cpp
+++ b/test/decoder/DecUT_ErrorConcealment.cpp
@@ -231,7 +231,7 @@ TEST (ErrorConTest, DoErrorConFrameCopy) {
     return;
   }
 
-  pECCtx->pCtx->iErrorConMethod = ERROR_CON_FRAME_COPY;
+  pECCtx->pCtx->eErrorConMethod = ERROR_CON_FRAME_COPY;
   InitECCopyData (pECCtx);
   //case 1: no reference picture
   pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL;
@@ -263,7 +263,7 @@ TEST (ErrorConTest, DoErrorConSliceCopy) {
     FreeInputData (pECCtx);
     return;
   }
-  pECCtx->pCtx->iErrorConMethod = ERROR_CON_SLICE_COPY;
+  pECCtx->pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY;
   InitECCopyData (pECCtx);
   //case 1: no reference picture
   pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL;