mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 02:00:33 +00:00
media: avoid element leak
This commit is contained in:
parent
4eb010824e
commit
28fd887547
2 changed files with 17 additions and 1 deletions
|
@ -226,6 +226,7 @@ gst_rtsp_media_finalize (GObject * obj)
|
||||||
|
|
||||||
if (priv->pipeline)
|
if (priv->pipeline)
|
||||||
gst_object_unref (priv->pipeline);
|
gst_object_unref (priv->pipeline);
|
||||||
|
gst_object_unref (priv->element);
|
||||||
if (priv->auth)
|
if (priv->auth)
|
||||||
g_object_unref (priv->auth);
|
g_object_unref (priv->auth);
|
||||||
if (priv->pool)
|
if (priv->pool)
|
||||||
|
@ -411,6 +412,7 @@ gst_rtsp_media_take_pipeline (GstRTSPMedia * media, GstPipeline * pipeline)
|
||||||
if (old)
|
if (old)
|
||||||
gst_object_unref (old);
|
gst_object_unref (old);
|
||||||
|
|
||||||
|
gst_object_ref (priv->element);
|
||||||
gst_bin_add (GST_BIN_CAST (pipeline), priv->element);
|
gst_bin_add (GST_BIN_CAST (pipeline), priv->element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,22 @@ GST_END_TEST;
|
||||||
GST_START_TEST (test_media)
|
GST_START_TEST (test_media)
|
||||||
{
|
{
|
||||||
GstRTSPMedia *media;
|
GstRTSPMedia *media;
|
||||||
|
GstElement *bin, *e1, *e2;
|
||||||
|
|
||||||
media = gst_rtsp_media_new (NULL);
|
bin = gst_bin_new ("bin");
|
||||||
|
fail_if (bin == NULL);
|
||||||
|
|
||||||
|
e1 = gst_element_factory_make ("videotestsrc", NULL);
|
||||||
|
fail_if (e1 == NULL);
|
||||||
|
|
||||||
|
e2 = gst_element_factory_make ("rtpvrawpay", "pay0");
|
||||||
|
fail_if (e2 == NULL);
|
||||||
|
g_object_set (e2, "pt", 96, NULL);
|
||||||
|
|
||||||
|
gst_bin_add_many (GST_BIN_CAST (bin), e1, e2, NULL);
|
||||||
|
gst_element_link_many (e1, e2, NULL);
|
||||||
|
|
||||||
|
media = gst_rtsp_media_new (bin);
|
||||||
fail_unless (GST_IS_RTSP_MEDIA (media));
|
fail_unless (GST_IS_RTSP_MEDIA (media));
|
||||||
g_object_unref (media);
|
g_object_unref (media);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue