rtsp-stream: fixed assert during update transport
authorSrimanta Panda <srimanta@axis.com>
Tue, 5 Jan 2016 12:10:36 +0000 (13:10 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 7 Jan 2016 12:31:03 +0000 (14:31 +0200)
When RTSP server trying update transport during multicast, it throws an
assert. The assert is thrown because it is trying to get the parent of
an non-existing funnel element.

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

gst/rtsp-server/rtsp-stream.c

index d64b5c3..883cbcf 100644 (file)
@@ -2911,7 +2911,7 @@ update_transport (GstRTSPStream * stream, GstRTSPStreamTransport * trans,
       GstRTSPMulticastTransportSource *source;
       GstBin *bin;
 
-      bin = GST_BIN (gst_object_get_parent (GST_OBJECT (priv->funnel[0])));
+      bin = GST_BIN (gst_object_get_parent (GST_OBJECT (priv->funnel[1])));
 
       if (add) {
         gchar *host;
@@ -2940,12 +2940,14 @@ update_transport (GstRTSPStream * stream, GstRTSPStreamTransport * trans,
           gst_bin_add (bin, source->udpsrc[i]);
 
           /* and link to the funnel v4 */
-          source->selpad[i] = selpad =
-              gst_element_get_request_pad (priv->funnel[i], "sink_%u");
-          pad = gst_element_get_static_pad (source->udpsrc[i], "src");
-          gst_pad_link (pad, selpad);
-          gst_object_unref (pad);
-          gst_object_unref (selpad);
+          if (priv->sinkpad || i == 1) {
+            source->selpad[i] = selpad =
+                gst_element_get_request_pad (priv->funnel[i], "sink_%u");
+            pad = gst_element_get_static_pad (source->udpsrc[i], "src");
+            gst_pad_link (pad, selpad);
+            gst_object_unref (pad);
+            gst_object_unref (selpad);
+          }
         }
 
         priv->transport_sources =
@@ -2974,8 +2976,10 @@ update_transport (GstRTSPStream * stream, GstRTSPStreamTransport * trans,
             gst_element_set_state (source->udpsrc[i], GST_STATE_NULL);
             gst_object_unref (source->udpsrc[i]);
 
-            gst_element_release_request_pad (priv->funnel[i],
-                source->selpad[i]);
+            if (priv->sinkpad || i == 1) {
+              gst_element_release_request_pad (priv->funnel[i],
+                  source->selpad[i]);
+            }
           }
 
           g_slice_free (GstRTSPMulticastTransportSource, source);