Force reset decoder when out of memory error
Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 4 files). Show all
Unified · Split
| @@ -259,6 +259,18 @@ int32_t CWelsDecoder::InitDecoder (const bool bParseOnly) { · 258 unmodified lines | |||
| 259 | return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx); | 259 | return WelsInitDecoder (m_pDecContext, bParseOnly, &m_pWelsTrace->m_sLogCtx); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | int32_t CWelsDecoder::ResetDecoder() { | ||
| 263 | // TBC: need to be modified when context and trace point are null | ||
| 264 | if (m_pDecContext != NULL && m_pWelsTrace != NULL) { | ||
| 265 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "ResetDecoder(), context error code is %d", | ||
| 266 | m_pDecContext->iErrorCode); | ||
| 267 | return InitDecoder (m_pDecContext->bParseOnly); | ||
| 268 | } else if (m_pWelsTrace != NULL) { | ||
| 269 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null"); | ||
| 270 | } | ||
| 271 | return ERR_INFO_UNINIT; | ||
| 272 | } | ||
| 273 | |||
| 262 | /* | 274 | /* |
| 263 | * Set Option | 275 | * Set Option |
| 264 | */ | 276 | */ |
| @@ -488,7 +500,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 223 unmodified lines | |||
| 488 | eNalType = m_pDecContext->sCurNalHead.eNalUnitType; | 500 | eNalType = m_pDecContext->sCurNalHead.eNalUnitType; |
| 489 | 501 | ||
| 490 | if (m_pDecContext->iErrorCode & dsOutOfMemory) { | 502 | if (m_pDecContext->iErrorCode & dsOutOfMemory) { |
| 491 | ForceResetParaSetStatusAndAUList (m_pDecContext); | 503 | ResetDecoder(); |
| 492 | } | 504 | } |
| 493 | //for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss. | 505 | //for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss. |
| 494 | if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) || | 506 | if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) || |