From e6cf62ebe21dd42896e4eaaa721d69974ff3d8ee Mon Sep 17 00:00:00 2001 From: Pascal EYMERY Date: Thu, 5 Apr 2018 15:43:14 +0200 Subject: [PATCH] Improve AVC decoder's error resilience Fix decoder when gaps_in_frame_num_value_allowed_flag=1 and IDR picture is present after first picture. Signed-off-by: Pascal EYMERY Signed-off-by: Jeegar Patel --- lib_parsing/Avc_PictMngr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_parsing/Avc_PictMngr.c b/lib_parsing/Avc_PictMngr.c index 46f3996..c89c529 100644 --- a/lib_parsing/Avc_PictMngr.c +++ b/lib_parsing/Avc_PictMngr.c @@ -360,7 +360,8 @@ void AL_AVC_PictMngr_Fill_Gap_In_FrameNum(AL_TPictMngrCtx* pCtx, AL_TAvcSliceHdr { uint32_t uMaxFrameNum = 1 << (pSlice->m_pSPS->log2_max_frame_num_minus4 + 4); - if(pSlice->frame_num != pCtx->m_iPrevFrameNum && + if(pSlice->nal_unit_type != 5 && /*non-IDR picture*/ + pSlice->frame_num != pCtx->m_iPrevFrameNum && pSlice->frame_num != (int)((pCtx->m_iPrevFrameNum + 1) % uMaxFrameNum)) { if(pSlice->m_pSPS->gaps_in_frame_num_value_allowed_flag) -- 1.8.3.1