mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-16 05:16:36 +00:00
ges: Fix several memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=710390
This commit is contained in:
parent
219154eacb
commit
5a5228a25a
9 changed files with 29 additions and 9 deletions
|
@ -88,6 +88,7 @@ ges_audio_source_create_element (GESTrackElement * trksrc)
|
||||||
_sync_element_to_layer_property_float (trksrc, volume, GES_META_VOLUME,
|
_sync_element_to_layer_property_float (trksrc, volume, GES_META_VOLUME,
|
||||||
"volume");
|
"volume");
|
||||||
ges_track_element_add_children_props (trksrc, volume, NULL, NULL, props);
|
ges_track_element_add_children_props (trksrc, volume, NULL, NULL, props);
|
||||||
|
gst_object_unref (volume);
|
||||||
|
|
||||||
return topbin;
|
return topbin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,9 @@ pad_added_cb (GstElement * timeline, GstPad * pad, GstElement * scale)
|
||||||
GST_DEBUG ("got sink pad, trying to link");
|
GST_DEBUG ("got sink pad, trying to link");
|
||||||
|
|
||||||
ret = gst_pad_link (pad, sinkpad);
|
ret = gst_pad_link (pad, sinkpad);
|
||||||
if GST_PAD_LINK_SUCCESSFUL
|
|
||||||
(ret) {
|
|
||||||
GST_DEBUG ("linked ok, returning");
|
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
|
if (GST_PAD_LINK_SUCCESSFUL (ret)) {
|
||||||
|
GST_DEBUG ("linked ok, returning");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,6 +733,7 @@ pad_removed_cb (GstElement * timeline, GstPad * pad, GESPipeline * self)
|
||||||
gst_object_unref (peer);
|
gst_object_unref (peer);
|
||||||
gst_element_release_request_pad (self->priv->encodebin,
|
gst_element_release_request_pad (self->priv->encodebin,
|
||||||
chain->encodebinpad);
|
chain->encodebinpad);
|
||||||
|
gst_object_unref (chain->encodebinpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlink playsink */
|
/* Unlink playsink */
|
||||||
|
|
|
@ -63,8 +63,10 @@ destroy_pad (PadInfos * infos)
|
||||||
gst_bin_remove (GST_BIN (infos->self), infos->bin);
|
gst_bin_remove (GST_BIN (infos->self), infos->bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infos->adder_pad)
|
if (infos->adder_pad) {
|
||||||
gst_element_release_request_pad (infos->self->adder, infos->adder_pad);
|
gst_element_release_request_pad (infos->self->adder, infos->adder_pad);
|
||||||
|
gst_object_unref (infos->adder_pad);
|
||||||
|
}
|
||||||
g_slice_free (PadInfos, infos);
|
g_slice_free (PadInfos, infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +193,7 @@ ges_smart_adder_init (GESSmartAdder * self)
|
||||||
pad = gst_element_get_static_pad (self->adder, "src");
|
pad = gst_element_get_static_pad (self->adder, "src");
|
||||||
self->srcpad = gst_ghost_pad_new ("src", pad);
|
self->srcpad = gst_ghost_pad_new ("src", pad);
|
||||||
gst_pad_set_active (self->srcpad, TRUE);
|
gst_pad_set_active (self->srcpad, TRUE);
|
||||||
|
gst_object_unref (pad);
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
|
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,10 @@ destroy_pad (PadInfos * infos)
|
||||||
gst_bin_remove (GST_BIN (infos->self), infos->bin);
|
gst_bin_remove (GST_BIN (infos->self), infos->bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (infos->mixer_pad)
|
if (infos->mixer_pad) {
|
||||||
gst_element_release_request_pad (infos->self->mixer, infos->mixer_pad);
|
gst_element_release_request_pad (infos->self->mixer, infos->mixer_pad);
|
||||||
|
gst_object_unref (infos->mixer_pad);
|
||||||
|
}
|
||||||
|
|
||||||
g_slice_free (PadInfos, infos);
|
g_slice_free (PadInfos, infos);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +218,7 @@ ges_smart_mixer_init (GESSmartMixer * self)
|
||||||
pad = gst_element_get_static_pad (self->mixer, "src");
|
pad = gst_element_get_static_pad (self->mixer, "src");
|
||||||
self->srcpad = gst_ghost_pad_new ("src", pad);
|
self->srcpad = gst_ghost_pad_new ("src", pad);
|
||||||
gst_pad_set_active (self->srcpad, TRUE);
|
gst_pad_set_active (self->srcpad, TRUE);
|
||||||
|
gst_object_unref (pad);
|
||||||
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
|
gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
|
||||||
|
|
||||||
self->pads_infos = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
self->pads_infos = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||||
|
|
|
@ -116,6 +116,9 @@ ges_source_create_topbin (const gchar * bin_name, GstElement * sub_element, ...)
|
||||||
G_CALLBACK (_ghost_pad_added_cb), bin);
|
G_CALLBACK (_ghost_pad_added_cb), bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sub_srcpad)
|
||||||
|
gst_object_unref (sub_srcpad);
|
||||||
|
|
||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ ges_title_source_create_source (GESTrackElement * object)
|
||||||
GESTitleSource *self = GES_TITLE_SOURCE (object);
|
GESTitleSource *self = GES_TITLE_SOURCE (object);
|
||||||
GESTitleSourcePrivate *priv = self->priv;
|
GESTitleSourcePrivate *priv = self->priv;
|
||||||
GstElement *topbin, *background, *text;
|
GstElement *topbin, *background, *text;
|
||||||
GstPad *src;
|
GstPad *src, *pad;
|
||||||
|
|
||||||
topbin = gst_bin_new ("titlesrc-bin");
|
topbin = gst_bin_new ("titlesrc-bin");
|
||||||
background = gst_element_factory_make ("videotestsrc", "titlesrc-bg");
|
background = gst_element_factory_make ("videotestsrc", "titlesrc-bg");
|
||||||
|
@ -172,7 +172,9 @@ ges_title_source_create_source (GESTrackElement * object)
|
||||||
gst_element_link_pads_full (background, "src", text, "video_sink",
|
gst_element_link_pads_full (background, "src", text, "video_sink",
|
||||||
GST_PAD_LINK_CHECK_NOTHING);
|
GST_PAD_LINK_CHECK_NOTHING);
|
||||||
|
|
||||||
src = gst_ghost_pad_new ("src", gst_element_get_static_pad (text, "src"));
|
pad = gst_element_get_static_pad (text, "src");
|
||||||
|
src = gst_ghost_pad_new ("src", pad);
|
||||||
|
gst_object_unref (pad);
|
||||||
gst_element_add_pad (topbin, src);
|
gst_element_add_pad (topbin, src);
|
||||||
|
|
||||||
gst_object_ref (text);
|
gst_object_ref (text);
|
||||||
|
|
|
@ -265,10 +265,12 @@ pad_added_cb (GstElement * element, GstPad * pad, GESTrack * track)
|
||||||
GST_DEBUG ("track:%p, pad %s:%s", track, GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG ("track:%p, pad %s:%s", track, GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
gst_pad_link (pad, capsfilter_sink);
|
gst_pad_link (pad, capsfilter_sink);
|
||||||
|
gst_object_unref (capsfilter_sink);
|
||||||
|
|
||||||
capsfilter_src = gst_element_get_static_pad (priv->capsfilter, "src");
|
capsfilter_src = gst_element_get_static_pad (priv->capsfilter, "src");
|
||||||
/* ghost the pad */
|
/* ghost the pad */
|
||||||
priv->srcpad = gst_ghost_pad_new ("src", capsfilter_src);
|
priv->srcpad = gst_ghost_pad_new ("src", capsfilter_src);
|
||||||
|
gst_object_unref (capsfilter_src);
|
||||||
gst_pad_set_active (priv->srcpad, TRUE);
|
gst_pad_set_active (priv->srcpad, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT (track), priv->srcpad);
|
gst_element_add_pad (GST_ELEMENT (track), priv->srcpad);
|
||||||
|
|
||||||
|
@ -423,6 +425,9 @@ ges_track_dispose (GObject * object)
|
||||||
g_sequence_free (priv->trackelements_by_start);
|
g_sequence_free (priv->trackelements_by_start);
|
||||||
g_list_free_full (priv->gaps, (GDestroyNotify) free_gap);
|
g_list_free_full (priv->gaps, (GDestroyNotify) free_gap);
|
||||||
|
|
||||||
|
if (priv->mixing_operation)
|
||||||
|
gst_object_unref (priv->mixing_operation);
|
||||||
|
|
||||||
if (priv->composition) {
|
if (priv->composition) {
|
||||||
gst_bin_remove (GST_BIN (object), priv->composition);
|
gst_bin_remove (GST_BIN (object), priv->composition);
|
||||||
priv->composition = NULL;
|
priv->composition = NULL;
|
||||||
|
@ -758,6 +763,8 @@ ges_track_set_mixing (GESTrack * track, gboolean mixing)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mixing) {
|
if (mixing) {
|
||||||
|
// increase ref count to hold the object
|
||||||
|
gst_object_ref (track->priv->mixing_operation);
|
||||||
if (!gst_bin_add (GST_BIN (track->priv->composition),
|
if (!gst_bin_add (GST_BIN (track->priv->composition),
|
||||||
track->priv->mixing_operation)) {
|
track->priv->mixing_operation)) {
|
||||||
GST_WARNING_OBJECT (track, "Could not add the mixer to our composition");
|
GST_WARNING_OBJECT (track, "Could not add the mixer to our composition");
|
||||||
|
|
|
@ -90,6 +90,8 @@ create_element_for_raw_video_gap (GESTrack * track)
|
||||||
|
|
||||||
_sync_capsfilter_with_track (track, capsfilter);
|
_sync_capsfilter_with_track (track, capsfilter);
|
||||||
|
|
||||||
|
gst_object_unref (capsfilter);
|
||||||
|
|
||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue