mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
va: h265enc: Change the set_property to make it atomic
The inside encoder may be set in other threads, so we should make its accessing atomic. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6471>
This commit is contained in:
parent
33bc8d75ad
commit
d179fca13f
1 changed files with 19 additions and 13 deletions
|
@ -4763,7 +4763,13 @@ gst_va_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstVaH265Enc *const self = GST_VA_H265_ENC (object);
|
GstVaH265Enc *const self = GST_VA_H265_ENC (object);
|
||||||
GstVaBaseEnc *base = GST_VA_BASE_ENC (self);
|
GstVaBaseEnc *base = GST_VA_BASE_ENC (self);
|
||||||
gboolean already_effect = FALSE;
|
GstVaEncoder *encoder = NULL;
|
||||||
|
gboolean no_effect;
|
||||||
|
|
||||||
|
gst_object_replace ((GstObject **) (&encoder), (GstObject *) base->encoder);
|
||||||
|
no_effect = (encoder && gst_va_encoder_is_open (encoder));
|
||||||
|
if (encoder)
|
||||||
|
gst_object_unref (encoder);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (self);
|
GST_OBJECT_LOCK (self);
|
||||||
|
|
||||||
|
@ -4794,18 +4800,18 @@ gst_va_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
case PROP_QP_I:
|
case PROP_QP_I:
|
||||||
self->prop.qp_i = g_value_get_uint (value);
|
self->prop.qp_i = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_QP_P:
|
case PROP_QP_P:
|
||||||
self->prop.qp_p = g_value_get_uint (value);
|
self->prop.qp_p = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_QP_B:
|
case PROP_QP_B:
|
||||||
self->prop.qp_b = g_value_get_uint (value);
|
self->prop.qp_b = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_TRELLIS:
|
case PROP_TRELLIS:
|
||||||
self->prop.use_trellis = g_value_get_boolean (value);
|
self->prop.use_trellis = g_value_get_boolean (value);
|
||||||
|
@ -4834,18 +4840,18 @@ gst_va_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
case PROP_BITRATE:
|
case PROP_BITRATE:
|
||||||
self->prop.bitrate = g_value_get_uint (value);
|
self->prop.bitrate = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_TARGET_PERCENTAGE:
|
case PROP_TARGET_PERCENTAGE:
|
||||||
self->prop.target_percentage = g_value_get_uint (value);
|
self->prop.target_percentage = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_TARGET_USAGE:
|
case PROP_TARGET_USAGE:
|
||||||
self->prop.target_usage = g_value_get_uint (value);
|
self->prop.target_usage = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_NUM_TILE_COLS:
|
case PROP_NUM_TILE_COLS:
|
||||||
self->prop.num_tile_cols = g_value_get_uint (value);
|
self->prop.num_tile_cols = g_value_get_uint (value);
|
||||||
|
@ -4855,11 +4861,12 @@ gst_va_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
break;
|
break;
|
||||||
case PROP_RATE_CONTROL:
|
case PROP_RATE_CONTROL:
|
||||||
self->prop.rc_ctrl = g_value_get_enum (value);
|
self->prop.rc_ctrl = g_value_get_enum (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
already_effect = TRUE;
|
|
||||||
break;
|
break;
|
||||||
case PROP_CPB_SIZE:
|
case PROP_CPB_SIZE:
|
||||||
self->prop.cpb_size = g_value_get_uint (value);
|
self->prop.cpb_size = g_value_get_uint (value);
|
||||||
|
no_effect = FALSE;
|
||||||
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
g_atomic_int_set (&GST_VA_BASE_ENC (self)->reconf, TRUE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -4868,13 +4875,12 @@ gst_va_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (self);
|
GST_OBJECT_UNLOCK (self);
|
||||||
|
|
||||||
|
if (no_effect) {
|
||||||
#ifndef GST_DISABLE_GST_DEBUG
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
if (!already_effect &&
|
GST_WARNING_OBJECT (self, "Property `%s` change may not take effect "
|
||||||
base->encoder && gst_va_encoder_is_open (base->encoder)) {
|
"until the next encoder reconfig.", pspec->name);
|
||||||
GST_WARNING_OBJECT (self, "Property `%s` change ignored while processing.",
|
|
||||||
pspec->name);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue