Merge pull request #1995 from sijchen/ps22

[Encoder] make two un-error ending of encoding go to a same exit and save the d…
This commit is contained in:
huili2 2015-06-19 08:44:55 +08:00
commit 2ca6af54b9

View File

@ -3850,15 +3850,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
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 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
// 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 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
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;
@ -4296,6 +4291,15 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
}
}
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)
TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum);
#endif//MT_DEBUG