libs: encoder: h264: simplify the view-ids setting

This commit is contained in:
Víctor Manuel Jáquez Leal 2019-03-29 18:29:51 +01:00
parent 6404bd399d
commit 7dc77ebf60

View file

@ -3441,11 +3441,11 @@ static void
set_view_ids (GstVaapiEncoderH264 * const encoder, const GValue * value) set_view_ids (GstVaapiEncoderH264 * const encoder, const GValue * value)
{ {
guint i, j; guint i, j;
gboolean use_default = TRUE;
guint len = gst_value_array_get_size (value); guint len = gst_value_array_get_size (value);
/* Try the user set view IDs */ if (len == 0)
if (len > 0) { goto set_default_ids;
if (len != encoder->num_views) { if (len != encoder->num_views) {
GST_WARNING ("The view number is %d, but %d view IDs are provided. Just " GST_WARNING ("The view number is %d, but %d view IDs are provided. Just "
"fallback to use default view IDs.", encoder->num_views, len); "fallback to use default view IDs.", encoder->num_views, len);
@ -3468,14 +3468,14 @@ set_view_ids (GstVaapiEncoderH264 * const encoder, const GValue * value)
} }
} }
use_default = FALSE; return;
}
set_default_ids: set_default_ids:
if (use_default) {
for (i = 0; i < encoder->num_views; i++) for (i = 0; i < encoder->num_views; i++)
encoder->view_ids[i] = i; encoder->view_ids[i] = i;
} }
}
static GstVaapiEncoderStatus static GstVaapiEncoderStatus
gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder, gst_vaapi_encoder_h264_set_property (GstVaapiEncoder * base_encoder,