encodebasebin: Encoding profile ownership fixes

The profile argument passed to gst_encode_base_bin_set_profile is now
transfer-full. This issue was noticed after commit
6beb709d43d2023e7e5dc8f1ee1323bc28c9d1d8 which fixed profile refcount handling
in transcodebin.

Driving-by, an encoding profile leak was also fixed in _set_profile, in case
it's called for an already active element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9167>
This commit is contained in:
Philippe Normand 2025-06-04 12:40:54 +02:00 committed by GStreamer Marge Bot
parent 0b12b883c9
commit 3719b5b616

View File

@ -482,7 +482,7 @@ gst_encode_base_bin_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_PROFILE:
gst_encode_base_bin_set_profile (ebin,
(GstEncodingProfile *) g_value_get_object (value));
(GstEncodingProfile *) g_value_dup_object (value));
break;
case PROP_QUEUE_BUFFERS_MAX:
ebin->queue_buffers_max = g_value_get_uint (value);
@ -2610,8 +2610,7 @@ gst_encode_base_bin_tear_down_profile (GstEncodeBaseBin * ebin)
}
/* free/clear profile */
gst_encoding_profile_unref (ebin->profile);
ebin->profile = NULL;
gst_clear_object (&ebin->profile);
}
static gboolean
@ -2627,7 +2626,6 @@ gst_encode_base_bin_setup_profile (GstEncodeBaseBin * ebin,
gst_encoding_profile_get_type_nick (profile));
ebin->profile = profile;
gst_object_ref (ebin->profile);
/* Create elements */
res = create_elements_and_pads (ebin);
@ -2648,6 +2646,7 @@ gst_encode_base_bin_set_profile (GstEncodeBaseBin * ebin,
if (G_UNLIKELY (ebin->active)) {
GST_WARNING_OBJECT (ebin, "Element already active, can't change profile");
gst_clear_object (&profile);
return FALSE;
}