libs: encoder: not call ensure_num_slices inside g_assert

g_assert will take no effect when glib's G_DISABLE_ASSERT macro is
defined. The function inside the g_assert will take no effect and
we will fail to set the correct slice number.
This commit is contained in:
He Junyan 2019-05-10 18:29:10 +08:00
parent 47d256b24c
commit 0af3e36068
2 changed files with 8 additions and 4 deletions

View file

@ -2748,6 +2748,7 @@ reset_properties (GstVaapiEncoderH264 * encoder)
{
GstVaapiEncoder *const base_encoder = GST_VAAPI_ENCODER_CAST (encoder);
guint mb_size, i;
gboolean ret;
if (encoder->idr_period < base_encoder->keyframe_period)
encoder->idr_period = base_encoder->keyframe_period;
@ -2757,8 +2758,9 @@ reset_properties (GstVaapiEncoderH264 * encoder)
encoder->qp_i = encoder->init_qp;
mb_size = encoder->mb_width * encoder->mb_height;
g_assert (gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (mb_size + 1) / 2, &encoder->num_slices));
ret = gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (mb_size + 1) / 2, &encoder->num_slices);
g_assert (ret);
if (encoder->num_bframes > (base_encoder->keyframe_period + 1) / 2)
encoder->num_bframes = (base_encoder->keyframe_period + 1) / 2;

View file

@ -2058,6 +2058,7 @@ reset_properties (GstVaapiEncoderH265 * encoder)
GstVaapiH265ReorderPool *reorder_pool;
GstVaapiH265RefPool *ref_pool;
guint ctu_size;
gboolean ret;
if (encoder->idr_period < base_encoder->keyframe_period)
encoder->idr_period = base_encoder->keyframe_period;
@ -2067,8 +2068,9 @@ reset_properties (GstVaapiEncoderH265 * encoder)
encoder->qp_i = encoder->init_qp;
ctu_size = encoder->ctu_width * encoder->ctu_height;
g_assert (gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (ctu_size + 1) / 2, &encoder->num_slices));
ret = gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (ctu_size + 1) / 2, &encoder->num_slices);
g_assert (ret);
gst_vaapi_encoder_ensure_max_num_ref_frames (base_encoder, encoder->profile,
encoder->entrypoint);