From 707ac9c4876be900dd227a648db94fdab78f7324 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Sat, 8 Aug 2015 09:40:09 -0400 Subject: [PATCH] media: Only add fakesink once per pipeline The intention is to prevent going PLAYING state before pads are created. If there was mutilple dynamic payload, it would leak few fakesink and actually prevent from ever reaching playing state. https://bugzilla.gnome.org/show_bug.cgi?id=753385 --- gst/rtsp-server/rtsp-media.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/rtsp-server/rtsp-media.c b/gst/rtsp-server/rtsp-media.c index 011dae39c2..e623f00e38 100644 --- a/gst/rtsp-server/rtsp-media.c +++ b/gst/rtsp-server/rtsp-media.c @@ -2517,10 +2517,12 @@ start_prepare (GstRTSPMedia * media) g_object_set_data (G_OBJECT (elem), "gst-rtsp-dynpay-handlers", handlers); - /* we add a fakesink here in order to make the state change async. We remove - * the fakesink again in the no-more-pads callback. */ - priv->fakesink = gst_element_factory_make ("fakesink", "fakesink"); - gst_bin_add (GST_BIN (priv->pipeline), priv->fakesink); + if (!priv->fakesink) { + /* we add a fakesink here in order to make the state change async. We remove + * the fakesink again in the no-more-pads callback. */ + priv->fakesink = gst_element_factory_make ("fakesink", "fakesink"); + gst_bin_add (GST_BIN (priv->pipeline), priv->fakesink); + } } if (!start_preroll (media))