ref: 2ca6af54b97040c87778bfb8ebc43a19d5a63832
parent: dea4303357a88f697868fbf6b38ff46fd20047bb
parent: 2ff38e9175704518cc5ea3cd7d37063760041089
author: huili2 <huili2@cisco.com>
date: Fri Jun 19 04:44:55 EDT 2015
Merge pull request #1995 from sijchen/ps22 [Encoder] make two un-error ending of encoding go to a same exit and save the d…
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3850,15 +3850,12 @@
pCtx->pFuncList->pMarkPic (pCtx);
if (!pCtx->pFuncList->pBuildRefList (pCtx, pCtx->iPOC, 0)) {
- pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx);
- // Force coding IDR as followed
- ForceCodingIDR (pCtx);
WelsLog (pLogCtx, WELS_LOG_WARNING,
"WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!",
pCtx->iNumRef0);
- pFbi->eFrameType = videoFrameTypeIDR;
+ eFrameType = videoFrameTypeIDR;
pCtx->iEncoderError = ENC_RETURN_CORRECTED;
- return ENC_RETURN_CORRECTED;
+ break;
}
if (pCtx->eSliceType != I_SLICE) {
pCtx->pFuncList->pAfterBuildRefList (pCtx);
@@ -4125,13 +4122,10 @@
// reference picture list update
if (eNalRefIdc != NRI_PRI_LOWEST) {
if (!pCtx->pFuncList->pUpdateRefList (pCtx)) {
- pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx);
- // Force coding IDR as followed
- ForceCodingIDR (pCtx);
WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!");
//the above is to set the next frame to be IDR
- pFbi->eFrameType = eFrameType;
- return ENC_RETURN_CORRECTED;
+ pCtx->iEncoderError = ENC_RETURN_CORRECTED;
+ break;
}
}
@@ -4284,7 +4278,8 @@
if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) {
ForceCodingIDR (pCtx);
- WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
+ WelsLog (pLogCtx, WELS_LOG_WARNING,
+ "WelsEncoderEncodeExt(), Logic Error Found in Preprocess updating. ForceCodingIDR!");
//the above is to set the next frame IDR
pFbi->eFrameType = eFrameType;
return ENC_RETURN_CORRECTED;
@@ -4294,6 +4289,15 @@
&& (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
pCtx->bRefOfCurTidIsLtr[iDidIdx][iCurTid] = true;
}
+ }
+
+ if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) {
+ pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid);
+ ForceCodingIDR (pCtx);
+ WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!");
+ //the above is to set the next frame IDR
+ pFbi->eFrameType = eFrameType;
+ return ENC_RETURN_CORRECTED;
}
#if defined(MT_DEBUG)