Merge "Added avc_dec_fuzzer" am: 219459dcb3 am: 6b7b0ac4ee am: 6cfc9cfe9c am: 808d34180a
am: 2461f041da

Change-Id: I9cc7972be34abb671bebe9597e8fe79a9bc9d369
diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c
index 8d50f9a..1f80912 100644
--- a/decoder/ih264d_parse_slice.c
+++ b/decoder/ih264d_parse_slice.c
@@ -835,12 +835,7 @@
             if(ret != OK)
                 return ret;
 
-            {
-                ivd_video_decode_op_t * ps_dec_output =
-                                (ivd_video_decode_op_t *)ps_dec->pv_dec_out;
 
-                ps_dec_output->u4_frame_decoded_flag = 1;
-            }
             if(ps_dec->au1_pic_buf_ref_flag[ps_dec->u1_pic_buf_id] == 0)
             {
                 ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr,
@@ -861,6 +856,11 @@
                         || ((TOP_FIELD_ONLY | BOT_FIELD_ONLY)
                                         == ps_dec->u1_top_bottom_decoded))
         {
+            ivd_video_decode_op_t * ps_dec_output =
+                            (ivd_video_decode_op_t *)ps_dec->pv_dec_out;
+            /* u4_frame_decoded_flag is set to 1 only after both fields
+             * are decoded or it is not a field */
+            ps_dec_output->u4_frame_decoded_flag = 1;
             if(IVD_DECODE_FRAME_OUT == ps_dec->e_frm_out_mode)
             {
                 ret = ih264d_assign_display_seq(ps_dec);