rtsp-media: Removed fakesink elements

There is not need of adding fakesink elements to the media
pipeline in the dynamic-payloader case.
The media pipeline itself is dynamically updated with
the receiver and sender parts that are based on the client
transport information known after SETUP has been received.

Change-Id: I4e88c9b500c04030669822f0d03b1842913f6cb9

https://bugzilla.gnome.org/show_bug.cgi?id=790674
This commit is contained in:
Patricia Muscalu 2017-11-23 18:39:44 +01:00 committed by Edward Hervey
parent ac6169d50a
commit 132e00adfd

View file

@ -116,7 +116,6 @@ struct _GstRTSPMediaPrivate
/* the pipeline for the media */ /* the pipeline for the media */
GstElement *pipeline; GstElement *pipeline;
GstElement *fakesink; /* protected by lock */
GSource *source; GSource *source;
guint id; guint id;
GstRTSPThread *thread; GstRTSPThread *thread;
@ -2719,38 +2718,15 @@ pad_removed_cb (GstElement * element, GstPad * pad, GstRTSPMedia * media)
gst_rtsp_media_remove_stream (media, stream); gst_rtsp_media_remove_stream (media, stream);
} }
static void
remove_fakesink (GstRTSPMediaPrivate * priv)
{
GstElement *fakesink;
g_mutex_lock (&priv->lock);
if ((fakesink = priv->fakesink))
gst_object_ref (fakesink);
priv->fakesink = NULL;
g_mutex_unlock (&priv->lock);
if (fakesink) {
gst_bin_remove (GST_BIN (priv->pipeline), fakesink);
gst_element_set_state (fakesink, GST_STATE_NULL);
gst_object_unref (fakesink);
GST_INFO ("removed fakesink");
}
}
static void static void
no_more_pads_cb (GstElement * element, GstRTSPMedia * media) no_more_pads_cb (GstElement * element, GstRTSPMedia * media)
{ {
GstRTSPMediaPrivate *priv = media->priv; GstRTSPMediaPrivate *priv = media->priv;
gboolean remaining_dynamic;
GST_INFO_OBJECT (element, "no more pads"); GST_INFO_OBJECT (element, "no more pads");
g_mutex_lock (&priv->lock); g_mutex_lock (&priv->lock);
priv->no_more_pads_pending--; priv->no_more_pads_pending--;
remaining_dynamic = priv->no_more_pads_pending;
g_mutex_unlock (&priv->lock); g_mutex_unlock (&priv->lock);
if (remaining_dynamic == 0)
remove_fakesink (priv);
} }
typedef struct _DynPaySignalHandlers DynPaySignalHandlers; typedef struct _DynPaySignalHandlers DynPaySignalHandlers;
@ -2893,13 +2869,6 @@ start_prepare (GstRTSPMedia * media)
(GCallback) no_more_pads_cb, media); (GCallback) no_more_pads_cb, media);
g_object_set_data (G_OBJECT (elem), "gst-rtsp-dynpay-handlers", handlers); g_object_set_data (G_OBJECT (elem), "gst-rtsp-dynpay-handlers", handlers);
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)) if (!start_preroll (media))
@ -3154,8 +3123,6 @@ finish_unprepare (GstRTSPMedia * media)
if (priv->status != GST_RTSP_MEDIA_STATUS_UNPREPARING) if (priv->status != GST_RTSP_MEDIA_STATUS_UNPREPARING)
return; return;
remove_fakesink (priv);
for (i = 0; i < priv->streams->len; i++) { for (i = 0; i < priv->streams->len; i++) {
GstRTSPStream *stream; GstRTSPStream *stream;