mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-11 16:55:23 +00:00
validate: media-descriptor-writer: fix pad leaks
- the pad returned by gst_element_get_static_pad() was leaked. - unref the pad from snode when updating it, not the pad passed as callback to pad_added_cb() Reviewed-by: Thibault Saunier <tsaunier@gnome.org> Differential Revision: https://phabricator.freedesktop.org/D958
This commit is contained in:
parent
e51912065e
commit
862b077569
1 changed files with 6 additions and 2 deletions
|
@ -421,16 +421,18 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
|
||||||
gst_bin_add (GST_BIN (writer->priv->pipeline), parser);
|
gst_bin_add (GST_BIN (writer->priv->pipeline), parser);
|
||||||
gst_element_sync_state_with_parent (parser);
|
gst_element_sync_state_with_parent (parser);
|
||||||
gst_pad_link (pad, sinkpad);
|
gst_pad_link (pad, sinkpad);
|
||||||
|
gst_object_unref (sinkpad);
|
||||||
|
|
||||||
srcpad = gst_element_get_static_pad (parser, "src");
|
srcpad = gst_element_get_static_pad (parser, "src");
|
||||||
} else {
|
} else {
|
||||||
srcpad = pad;
|
srcpad = gst_object_ref (pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
sinkpad = gst_element_get_static_pad (fakesink, "sink");
|
sinkpad = gst_element_get_static_pad (fakesink, "sink");
|
||||||
gst_bin_add (GST_BIN (writer->priv->pipeline), fakesink);
|
gst_bin_add (GST_BIN (writer->priv->pipeline), fakesink);
|
||||||
gst_element_sync_state_with_parent (fakesink);
|
gst_element_sync_state_with_parent (fakesink);
|
||||||
gst_pad_link (srcpad, sinkpad);
|
gst_pad_link (srcpad, sinkpad);
|
||||||
|
gst_object_unref (sinkpad);
|
||||||
gst_pad_sticky_events_foreach (pad,
|
gst_pad_sticky_events_foreach (pad,
|
||||||
(GstPadStickyEventsForeachFunction) _find_stream_id, writer);
|
(GstPadStickyEventsForeachFunction) _find_stream_id, writer);
|
||||||
|
|
||||||
|
@ -440,7 +442,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
|
||||||
(GstValidateMediaDescriptor *)
|
(GstValidateMediaDescriptor *)
|
||||||
writer, pad);
|
writer, pad);
|
||||||
if (snode) {
|
if (snode) {
|
||||||
gst_object_unref (pad);
|
gst_object_unref (snode->pad);
|
||||||
snode->pad = gst_object_ref (srcpad);
|
snode->pad = gst_object_ref (srcpad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,6 +450,8 @@ pad_added_cb (GstElement * decodebin, GstPad * pad,
|
||||||
gst_pad_add_probe (srcpad,
|
gst_pad_add_probe (srcpad,
|
||||||
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||||
(GstPadProbeCallback) _uridecodebin_probe, writer, NULL);
|
(GstPadProbeCallback) _uridecodebin_probe, writer, NULL);
|
||||||
|
|
||||||
|
gst_object_unref (srcpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue