Commit 28fd8875 authored by Wim Taymans's avatar Wim Taymans

media: avoid element leak

parent 4eb01082
......@@ -226,6 +226,7 @@ gst_rtsp_media_finalize (GObject * obj)
if (priv->pipeline)
gst_object_unref (priv->pipeline);
gst_object_unref (priv->element);
if (priv->auth)
g_object_unref (priv->auth);
if (priv->pool)
......@@ -411,6 +412,7 @@ gst_rtsp_media_take_pipeline (GstRTSPMedia * media, GstPipeline * pipeline)
if (old)
gst_object_unref (old);
gst_object_ref (priv->element);
gst_bin_add (GST_BIN_CAST (pipeline), priv->element);
}
......
......@@ -92,8 +92,22 @@ GST_END_TEST;
GST_START_TEST (test_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));
g_object_unref (media);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment