decoder: Fix in detecting dangling fields

When decoder is expecting to decode a field, ensure current slice
being decoded is a field and frame number matches with previous slice's
frame number.

Bug: 144687080
Test: poc in bug
Change-Id: I89d9d7b6fc26797de0420ecb0ca7e66b066aa908
This commit is contained in:
Harish Mahendrakar 2019-12-30 16:56:12 -08:00 committed by Ray Essick
parent 8c2ee3ea8b
commit 6dd54b9e18

View file

@ -1307,7 +1307,12 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream)
{
if(u2_frame_num != ps_dec->u2_prv_frame_num
/* If the current slice is not a field or frame number of the current
* slice doesn't match with previous slice, and decoder is expecting
* to decode a field i.e. ps_dec->u1_top_bottom_decoded is not 0 and
* is not (TOP_FIELD_ONLY | BOT_FIELD_ONLY), treat it as a dangling
* field */
if((u1_field_pic_flag == 0 || u2_frame_num != ps_dec->u2_prv_frame_num)
&& ps_dec->u1_top_bottom_decoded != 0
&& ps_dec->u1_top_bottom_decoded
!= (TOP_FIELD_ONLY | BOT_FIELD_ONLY))