rtsp-stream: only create funnel if it didn't exist already.
authorMathieu Duponchelle <mathieu@centricular.com>
Tue, 19 Jun 2018 22:10:18 +0000 (00:10 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Tue, 19 Jun 2018 23:36:57 +0000 (01:36 +0200)
This precented using multiple protocols for the same stream.

https://bugzilla.gnome.org/show_bug.cgi?id=796634

gst/rtsp-server/rtsp-stream.c

index 40c1224..e9be929 100644 (file)
@@ -3068,12 +3068,14 @@ create_receiver_part (GstRTSPStream * stream, const GstRTSPTransport *
     }
 
     /* make funnel for the RTP/RTCP receivers */
-    priv->funnel[i] = gst_element_factory_make ("funnel", NULL);
-    gst_bin_add (bin, priv->funnel[i]);
+    if (!priv->funnel[i]) {
+      priv->funnel[i] = gst_element_factory_make ("funnel", NULL);
+      gst_bin_add (bin, priv->funnel[i]);
 
-    pad = gst_element_get_static_pad (priv->funnel[i], "src");
-    gst_pad_link (pad, priv->recv_sink[i]);
-    gst_object_unref (pad);
+      pad = gst_element_get_static_pad (priv->funnel[i], "src");
+      gst_pad_link (pad, priv->recv_sink[i]);
+      gst_object_unref (pad);
+    }
 
     if (udp && !priv->udpsrc_v4[i] && priv->server_addr_v4) {
       GST_DEBUG_OBJECT (stream, "udp IPv4, create and configure udpsources");