Decoder: In case of no free buffers, release all buffers
When decoding erroneous streams, decoder may run out of all buffers used to hold reference pictures and MV data. In such cases, ignore all frames till the next IDR frame and then release all buffers while decoding the IDR frame. Bug: 236102268 Test: multiple seek on the clip in bug Change-Id: I14d107a5fdaf5c8d2133e59f48c2b947a5fee5ff
This commit is contained in:
parent
aeb7fa461e
commit
2a238075dc
1 changed files with 28 additions and 53 deletions
|
|
@ -409,9 +409,36 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free(
|
||||
(buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
&cur_pic_buf_id);
|
||||
|
||||
/* In case of IDR slices, if there is no free picture buffer, then release
|
||||
* all buffers from display and reference
|
||||
*/
|
||||
if((ps_cur_pic == NULL) && (ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL))
|
||||
{
|
||||
WORD32 j;
|
||||
|
||||
for(j = 0; j < MAX_DISP_BUFS_NEW; j++)
|
||||
{
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
j,
|
||||
BUF_MGR_REF);
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
|
||||
ps_dec->as_buf_id_info_map[j].mv_buf_id,
|
||||
BUF_MGR_REF);
|
||||
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
j,
|
||||
BUF_MGR_IO);
|
||||
}
|
||||
ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free(
|
||||
(buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
&cur_pic_buf_id);
|
||||
}
|
||||
|
||||
if(ps_cur_pic == NULL)
|
||||
{
|
||||
ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T;
|
||||
ps_dec->ps_dec_err_status->u1_err_flag |= REJECT_CUR_PIC;
|
||||
return ERROR_UNAVAIL_PICBUF_T;
|
||||
}
|
||||
if(0 == ps_dec->u4_disp_buf_mapping[cur_pic_buf_id])
|
||||
|
|
@ -425,6 +452,7 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
if(ps_col_mv == NULL)
|
||||
{
|
||||
ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T;
|
||||
ps_dec->ps_dec_err_status->u1_err_flag |= REJECT_CUR_PIC;
|
||||
return ERROR_UNAVAIL_MVBUF_T;
|
||||
}
|
||||
|
||||
|
|
@ -470,59 +498,6 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
|
|||
*(ps_dec->ps_dpb_mgr->ps_mod_dpb[1][MAX_REF_BUFS]) = *ps_cur_pic;
|
||||
}
|
||||
|
||||
if(!ps_dec->ps_cur_pic)
|
||||
{
|
||||
WORD32 j;
|
||||
H264_DEC_DEBUG_PRINT("------- Display Buffers Reset --------\n");
|
||||
for(j = 0; j < MAX_DISP_BUFS_NEW; j++)
|
||||
{
|
||||
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
j,
|
||||
BUF_MGR_REF);
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
|
||||
ps_dec->as_buf_id_info_map[j].mv_buf_id,
|
||||
BUF_MGR_REF);
|
||||
ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
j,
|
||||
BUF_MGR_IO);
|
||||
}
|
||||
|
||||
ps_dec->i4_cur_display_seq = 0;
|
||||
ps_dec->i4_prev_max_display_seq = 0;
|
||||
ps_dec->i4_max_poc = 0;
|
||||
|
||||
ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free(
|
||||
(buf_mgr_t *)ps_dec->pv_pic_buf_mgr,
|
||||
&cur_pic_buf_id);
|
||||
if(ps_cur_pic == NULL)
|
||||
{
|
||||
ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T;
|
||||
return ERROR_UNAVAIL_PICBUF_T;
|
||||
}
|
||||
|
||||
ps_col_mv = (col_mv_buf_t *)ih264_buf_mgr_get_next_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
|
||||
&cur_mv_buf_id);
|
||||
if(ps_col_mv == NULL)
|
||||
{
|
||||
ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T;
|
||||
return ERROR_UNAVAIL_MVBUF_T;
|
||||
}
|
||||
|
||||
ps_dec->ps_cur_pic = ps_cur_pic;
|
||||
ps_dec->u1_pic_buf_id = cur_pic_buf_id;
|
||||
ps_cur_pic->u4_ts = ps_dec->u4_ts;
|
||||
ps_dec->apv_buf_id_pic_buf_map[cur_pic_buf_id] = (void *)ps_cur_pic;
|
||||
|
||||
ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id;
|
||||
ps_dec->as_buf_id_info_map[cur_pic_buf_id].mv_buf_id = cur_mv_buf_id;
|
||||
|
||||
ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag;
|
||||
ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv;
|
||||
ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0;
|
||||
|
||||
}
|
||||
|
||||
ps_dec->ps_cur_pic->u1_picturetype = u1_field_pic_flag;
|
||||
ps_dec->ps_cur_pic->u4_pack_slc_typ = SKIP_NONE;
|
||||
H264_DEC_DEBUG_PRINT("got a buffer\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue