[Encoder] make two un-error ending of encoding go to a same exit and save the d…
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -3850,15 +3850,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3849 unmodified lines | ||
| 3850 | 3850 | |
| 3851 | 3851 | pCtx->pFuncList->pMarkPic (pCtx); |
| 3852 | 3852 | if (!pCtx->pFuncList->pBuildRefList (pCtx, pCtx->iPOC, 0)) { |
| 3853 | − pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx); | |
| 3854 | − // Force coding IDR as followed | |
| 3855 | − ForceCodingIDR (pCtx); | |
| 3856 | 3853 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 3857 | 3854 | "WelsEncoderEncodeExt(), WelsBuildRefList failed for P frames, pCtx->iNumRef0= %d. ForceCodingIDR!", |
| 3858 | 3855 | pCtx->iNumRef0); |
| 3859 | − pFbi->eFrameType = videoFrameTypeIDR; | |
| 3856 | + eFrameType = videoFrameTypeIDR; | |
| 3860 | 3857 | pCtx->iEncoderError = ENC_RETURN_CORRECTED; |
| 3861 | − return ENC_RETURN_CORRECTED; | |
| 3858 | + break; | |
| 3862 | 3859 | } |
| 3863 | 3860 | if (pCtx->eSliceType != I_SLICE) { |
| 3864 | 3861 | pCtx->pFuncList->pAfterBuildRefList (pCtx); |
| @@ -4125,13 +4122,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 260 unmodified lines | ||
| 4125 | 4122 | // reference picture list update |
| 4126 | 4123 | if (eNalRefIdc != NRI_PRI_LOWEST) { |
| 4127 | 4124 | if (!pCtx->pFuncList->pUpdateRefList (pCtx)) { |
| 4128 | − pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx); | |
| 4129 | − // Force coding IDR as followed | |
| 4130 | − ForceCodingIDR (pCtx); | |
| 4131 | 4125 | WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), WelsUpdateRefList failed. ForceCodingIDR!"); |
| 4132 | 4126 | //the above is to set the next frame to be IDR |
| 4133 | − pFbi->eFrameType = eFrameType; | |
| 4134 | − return ENC_RETURN_CORRECTED; | |
| 4127 | + pCtx->iEncoderError = ENC_RETURN_CORRECTED; | |
| 4128 | + break; | |
| 4135 | 4129 | } |
| 4136 | 4130 | } |
| 4137 | 4131 | |
| @@ -4284,7 +4278,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 146 unmodified lines | ||
| 4284 | 4278 | |
| 4285 | 4279 | if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) { |
| 4286 | 4280 | ForceCodingIDR (pCtx); |
| 4287 | − WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!"); | |
| 4281 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 4282 | + "WelsEncoderEncodeExt(), Logic Error Found in Preprocess updating. ForceCodingIDR!"); | |
| 4288 | 4283 | //the above is to set the next frame IDR |
| 4289 | 4284 | pFbi->eFrameType = eFrameType; |
| 4290 | 4285 | return ENC_RETURN_CORRECTED; |
| @@ -4296,6 +4291,15 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 5 unmodified lines | ||
| 4296 | 4291 | } |
| 4297 | 4292 | } |
| 4298 | 4293 | |
| 4294 | + if (ENC_RETURN_CORRECTED == pCtx->iEncoderError) { | |
| 4295 | + pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, (pSpatialIndexMap + iSpatialIdx)->iDid); | |
| 4296 | + ForceCodingIDR (pCtx); | |
| 4297 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!"); | |
| 4298 | + //the above is to set the next frame IDR | |
| 4299 | + pFbi->eFrameType = eFrameType; | |
| 4300 | + return ENC_RETURN_CORRECTED; | |
| 4301 | + } | |
| 4302 | + | |
| 4299 | 4303 | #if defined(MT_DEBUG) |
| 4300 | 4304 | TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum); |
| 4301 | 4305 | #endif//MT_DEBUG |