Force reset decoder when out of memory error
This commit is contained in:
@@ -92,6 +92,7 @@ ERR_INFO_WRITE_FAULT,
|
|||||||
ERR_INFO_READ_FAULT,
|
ERR_INFO_READ_FAULT,
|
||||||
ERR_INFO_READ_OVERFLOW,
|
ERR_INFO_READ_OVERFLOW,
|
||||||
ERR_INFO_READ_LEADING_ZERO,
|
ERR_INFO_READ_LEADING_ZERO,
|
||||||
|
ERR_INFO_UNINIT,
|
||||||
/* Error from H.264 syntax elements parser: 1001-10000 */
|
/* Error from H.264 syntax elements parser: 1001-10000 */
|
||||||
ERR_INFO_NO_PREFIX_CODE = ERR_INFO_SYNTAX_BASE, // No start prefix code indication
|
ERR_INFO_NO_PREFIX_CODE = ERR_INFO_SYNTAX_BASE, // No start prefix code indication
|
||||||
ERR_INFO_NO_PARAM_SETS, // No SPS and/ PPS before sequence header
|
ERR_INFO_NO_PARAM_SETS, // No SPS and/ PPS before sequence header
|
||||||
|
|||||||
@@ -2152,6 +2152,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
|
||||||
"DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:%d.",
|
"DecodeCurrentAccessUnit()::::::PrefetchPic ERROR, pSps->iNumRefFrames:%d.",
|
||||||
pCtx->pSps->iNumRefFrames);
|
pCtx->pSps->iNumRefFrames);
|
||||||
|
// The error code here need to be separated from the dsOutOfMemory
|
||||||
pCtx->iErrorCode |= dsOutOfMemory;
|
pCtx->iErrorCode |= dsOutOfMemory;
|
||||||
return ERR_INFO_REF_COUNT_OVERFLOW;
|
return ERR_INFO_REF_COUNT_OVERFLOW;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ welsCodecTrace* m_pWelsTrace;
|
|||||||
|
|
||||||
int32_t InitDecoder (const bool);
|
int32_t InitDecoder (const bool);
|
||||||
void UninitDecoder (void);
|
void UninitDecoder (void);
|
||||||
|
int32_t ResetDecoder();
|
||||||
|
|
||||||
#ifdef OUTPUT_BIT_STREAM
|
#ifdef OUTPUT_BIT_STREAM
|
||||||
WelsFileHandle* m_pFBS;
|
WelsFileHandle* m_pFBS;
|
||||||
|
|||||||
@@ -258,6 +258,18 @@ int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) {
|
|||||||
return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx);
|
return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CWelsDecoder::ResetDecoder() {
|
||||||
|
// TBC: need to be modified when context and trace point are null
|
||||||
|
if (m_pDecContext != NULL && m_pWelsTrace != NULL) {
|
||||||
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ResetDecoder(), context error code is %d",
|
||||||
|
m_pDecContext->iErrorCode);
|
||||||
|
return InitDecoder (m_pDecContext->bParseOnly);
|
||||||
|
} else if (m_pWelsTrace != NULL) {
|
||||||
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null");
|
||||||
|
}
|
||||||
|
return ERR_INFO_UNINIT;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set Option
|
* Set Option
|
||||||
*/
|
*/
|
||||||
@@ -487,7 +499,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
|||||||
eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
|
eNalType = m_pDecContext->sCurNalHead.eNalUnitType;
|
||||||
|
|
||||||
if (m_pDecContext->iErrorCode & dsOutOfMemory) {
|
if (m_pDecContext->iErrorCode & dsOutOfMemory) {
|
||||||
ForceResetParaSetStatusAndAUList (m_pDecContext);
|
ResetDecoder();
|
||||||
}
|
}
|
||||||
//for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.
|
//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) ||
|
if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user