mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
rtsp-media: Do not leak the element in take_pipeline
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=702470
This commit is contained in:
parent
7e9df0e112
commit
d9e245e62e
2 changed files with 27 additions and 1 deletions
|
@ -310,6 +310,7 @@ gst_rtsp_media_set_property (GObject * object, guint propid,
|
|||
switch (propid) {
|
||||
case PROP_ELEMENT:
|
||||
media->priv->element = g_value_get_object (value);
|
||||
gst_object_ref_sink (media->priv->element);
|
||||
break;
|
||||
case PROP_SHARED:
|
||||
gst_rtsp_media_set_shared (media, g_value_get_boolean (value));
|
||||
|
@ -463,7 +464,6 @@ gst_rtsp_media_take_pipeline (GstRTSPMedia * media, GstPipeline * pipeline)
|
|||
if (nettime)
|
||||
gst_object_unref (nettime);
|
||||
|
||||
gst_object_ref (priv->element);
|
||||
gst_bin_add (GST_BIN_CAST (pipeline), priv->element);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,6 +237,31 @@ GST_START_TEST (test_media_dyn_prepare)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_media_take_pipeline)
|
||||
{
|
||||
GstRTSPMediaFactory *factory;
|
||||
GstRTSPMedia *media;
|
||||
GstRTSPUrl *url;
|
||||
GstElement *pipeline;
|
||||
|
||||
factory = gst_rtsp_media_factory_new ();
|
||||
gst_rtsp_url_parse ("rtsp://localhost:8554/test", &url);
|
||||
gst_rtsp_media_factory_set_launch (factory,
|
||||
"( fakesrc ! text/plain ! rtpgstpay name=pay0 )");
|
||||
|
||||
media = gst_rtsp_media_factory_construct (factory, url);
|
||||
fail_unless (GST_IS_RTSP_MEDIA (media));
|
||||
|
||||
pipeline = gst_pipeline_new ("media-pipeline");
|
||||
gst_rtsp_media_take_pipeline (media, GST_PIPELINE_CAST (pipeline));
|
||||
|
||||
g_object_unref (media);
|
||||
gst_rtsp_url_free (url);
|
||||
g_object_unref (factory);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
rtspmedia_suite (void)
|
||||
{
|
||||
|
@ -249,6 +274,7 @@ rtspmedia_suite (void)
|
|||
tcase_add_test (tc, test_media);
|
||||
tcase_add_test (tc, test_media_prepare);
|
||||
tcase_add_test (tc, test_media_dyn_prepare);
|
||||
tcase_add_test (tc, test_media_take_pipeline);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue