encodebasebin: GstPad and GstStructure leak fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9167>
This commit is contained in:
parent
1d20fd15b0
commit
3b896cd4ea
@ -947,7 +947,7 @@ set_element_properties_from_encoding_profile (GstEncodingProfile * profile,
|
|||||||
if (!factory) {
|
if (!factory) {
|
||||||
GST_INFO_OBJECT (profile, "No factory for underlying element, "
|
GST_INFO_OBJECT (profile, "No factory for underlying element, "
|
||||||
"not setting properties");
|
"not setting properties");
|
||||||
return;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
v = gst_structure_get_value (properties, "map");
|
v = gst_structure_get_value (properties, "map");
|
||||||
@ -1522,7 +1522,7 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
const gchar * sinkpadname, GstCaps * sinkcaps, gboolean * encoder_not_found)
|
const gchar * sinkpadname, GstCaps * sinkcaps, gboolean * encoder_not_found)
|
||||||
{
|
{
|
||||||
StreamGroup *sgroup = NULL;
|
StreamGroup *sgroup = NULL;
|
||||||
GstPad *sinkpad, *srcpad = NULL, *muxerpad = NULL;
|
GstPad *sinkpad = NULL, *srcpad = NULL, *muxerpad = NULL;
|
||||||
/* Element we will link to the encoder */
|
/* Element we will link to the encoder */
|
||||||
GstElement *last = NULL;
|
GstElement *last = NULL;
|
||||||
GstElement *encoder = NULL;
|
GstElement *encoder = NULL;
|
||||||
@ -1751,7 +1751,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
gst_bin_add ((GstBin *) ebin, sgroup->smartencoder);
|
gst_bin_add ((GstBin *) ebin, sgroup->smartencoder);
|
||||||
srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src");
|
srcpad = gst_element_get_static_pad (sgroup->smartencoder, "src");
|
||||||
fast_pad_link (srcpad, sinkpad);
|
fast_pad_link (srcpad, sinkpad);
|
||||||
gst_object_unref (srcpad);
|
gst_clear_object (&srcpad);
|
||||||
|
gst_clear_object (&sinkpad);
|
||||||
tosync = g_list_append (tosync, sgroup->smartencoder);
|
tosync = g_list_append (tosync, sgroup->smartencoder);
|
||||||
sinkpad = gst_element_get_static_pad (sgroup->smartencoder, "sink");
|
sinkpad = gst_element_get_static_pad (sgroup->smartencoder, "sink");
|
||||||
}
|
}
|
||||||
@ -1766,9 +1767,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
/* Go straight to splitter */
|
/* Go straight to splitter */
|
||||||
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
||||||
goto passthrough_link_failure;
|
goto passthrough_link_failure;
|
||||||
gst_object_unref (sinkpad);
|
gst_clear_object (&sinkpad);
|
||||||
gst_object_unref (srcpad);
|
gst_clear_object (&srcpad);
|
||||||
srcpad = NULL;
|
|
||||||
|
|
||||||
/* Path 2 : Conversion / Encoding */
|
/* Path 2 : Conversion / Encoding */
|
||||||
|
|
||||||
@ -1786,9 +1786,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
srcpad = gst_element_get_static_pad (sgroup->encoder, "src");
|
srcpad = gst_element_get_static_pad (sgroup->encoder, "src");
|
||||||
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
||||||
goto encoder_link_failure;
|
goto encoder_link_failure;
|
||||||
gst_object_unref (sinkpad);
|
gst_clear_object (&sinkpad);
|
||||||
gst_object_unref (srcpad);
|
gst_clear_object (&srcpad);
|
||||||
srcpad = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1940,6 +1939,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Link to stream splitter */
|
/* Link to stream splitter */
|
||||||
|
gst_clear_object (&sinkpad);
|
||||||
|
gst_clear_object (&srcpad);
|
||||||
sinkpad = gst_element_get_static_pad (last, "sink");
|
sinkpad = gst_element_get_static_pad (last, "sink");
|
||||||
srcpad =
|
srcpad =
|
||||||
local_element_request_pad (sgroup->splitter, NULL, "encodingsrc", NULL);
|
local_element_request_pad (sgroup->splitter, NULL, "encodingsrc", NULL);
|
||||||
@ -1947,9 +1948,8 @@ _create_stream_group (GstEncodeBaseBin * ebin, GstEncodingProfile * sprof,
|
|||||||
goto no_splitter_srcpad;
|
goto no_splitter_srcpad;
|
||||||
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
if (G_UNLIKELY (fast_pad_link (srcpad, sinkpad) != GST_PAD_LINK_OK))
|
||||||
goto splitter_encoding_failure;
|
goto splitter_encoding_failure;
|
||||||
gst_object_unref (sinkpad);
|
gst_clear_object (&sinkpad);
|
||||||
gst_object_unref (srcpad);
|
gst_clear_object (&srcpad);
|
||||||
srcpad = NULL;
|
|
||||||
|
|
||||||
/* End of Stream 2 setup */
|
/* End of Stream 2 setup */
|
||||||
|
|
||||||
@ -2054,8 +2054,8 @@ cleanup:
|
|||||||
gst_caps_unref (format);
|
gst_caps_unref (format);
|
||||||
if (restriction)
|
if (restriction)
|
||||||
gst_caps_unref (restriction);
|
gst_caps_unref (restriction);
|
||||||
if (srcpad)
|
gst_clear_object (&sinkpad);
|
||||||
gst_object_unref (srcpad);
|
gst_clear_object (&srcpad);
|
||||||
stream_group_free (ebin, sgroup);
|
stream_group_free (ebin, sgroup);
|
||||||
g_list_free (tosync);
|
g_list_free (tosync);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user