h264dec: Properly set sentinel in ref frame list

This ensure that we always have sentinels set in the reference
pictures arrays. The code wasn't unsafe, this simply improve the
tracing, so instead of printing 32 lines of zeros, va tracer
prints proper empty lists.

https://bugzilla.gnome.org/show_bug.cgi?id=796169
This commit is contained in:
Nicolas Dufresne 2018-05-18 17:03:57 -04:00
parent 6ccd5d6fb2
commit 076af84654

View file

@ -4199,6 +4199,10 @@ fill_RefPicList (GstVaapiDecoderH264 * decoder,
slice_param->num_ref_idx_l0_active_minus1 = 0; slice_param->num_ref_idx_l0_active_minus1 = 0;
slice_param->num_ref_idx_l1_active_minus1 = 0; slice_param->num_ref_idx_l1_active_minus1 = 0;
/* ensure empty list by default */
vaapi_init_picture (&slice_param->RefPicList0[0]);
vaapi_init_picture (&slice_param->RefPicList1[0]);
if (GST_H264_IS_B_SLICE (slice_hdr)) if (GST_H264_IS_B_SLICE (slice_hdr))
num_ref_lists = 2; num_ref_lists = 2;
else if (GST_H264_IS_I_SLICE (slice_hdr)) else if (GST_H264_IS_I_SLICE (slice_hdr))
@ -4215,7 +4219,7 @@ fill_RefPicList (GstVaapiDecoderH264 * decoder,
for (i = 0; i < priv->RefPicList0_count && priv->RefPicList0[i]; i++) for (i = 0; i < priv->RefPicList0_count && priv->RefPicList0[i]; i++)
vaapi_fill_picture_for_RefPicListX (&slice_param->RefPicList0[i], vaapi_fill_picture_for_RefPicListX (&slice_param->RefPicList0[i],
priv->RefPicList0[i]); priv->RefPicList0[i]);
for (; i <= slice_param->num_ref_idx_l0_active_minus1; i++) if (i < 32)
vaapi_init_picture (&slice_param->RefPicList0[i]); vaapi_init_picture (&slice_param->RefPicList0[i]);
if (num_ref_lists < 2) if (num_ref_lists < 2)
@ -4227,8 +4231,9 @@ fill_RefPicList (GstVaapiDecoderH264 * decoder,
for (i = 0; i < priv->RefPicList1_count && priv->RefPicList1[i]; i++) for (i = 0; i < priv->RefPicList1_count && priv->RefPicList1[i]; i++)
vaapi_fill_picture_for_RefPicListX (&slice_param->RefPicList1[i], vaapi_fill_picture_for_RefPicListX (&slice_param->RefPicList1[i],
priv->RefPicList1[i]); priv->RefPicList1[i]);
for (; i <= slice_param->num_ref_idx_l1_active_minus1; i++) if (i < 32)
vaapi_init_picture (&slice_param->RefPicList1[i]); vaapi_init_picture (&slice_param->RefPicList1[i]);
return TRUE; return TRUE;
} }