diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index 2258ccafeb..efe0be66fd 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -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); } diff --git a/tests/check/gst/media.c b/tests/check/gst/media.c index c1115de98e..a237339d08 100644 --- a/tests/check/gst/media.c +++ b/tests/check/gst/media.c @@ -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); }