From 1b47b6d9b03bf93c3e5b0a2885c51851ef61d1e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 13 Aug 2014 17:22:16 +0300 Subject: [PATCH] rtsp-stream: Remove the multicast group udp sources when removing from the bin --- gst/rtsp-server/rtsp-stream.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index 0b02570..68d7bec 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1949,6 +1949,7 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin, { GstRTSPStreamPrivate *priv; gint i; + GList *l; g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE); g_return_val_if_fail (GST_IS_BIN (bin), FALSE); @@ -1999,6 +2000,18 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin, gst_element_set_state (priv->udpsrc_v6[i], GST_STATE_NULL); gst_bin_remove (bin, priv->udpsrc_v6[i]); } + + for (l = priv->transport_sources; l; l = l->next) { + GstRTSPMulticastTransportSource *s = l->data; + + if (!s->udpsrc[i]) + continue; + + gst_element_set_locked_state (s->udpsrc[i], FALSE); + gst_element_set_state (s->udpsrc[i], GST_STATE_NULL); + gst_bin_remove (bin, s->udpsrc[i]); + } + if (priv->udpsink[i]) gst_bin_remove (bin, priv->udpsink[i]); if (priv->appsrc[i]) @@ -2025,6 +2038,14 @@ gst_rtsp_stream_leave_bin (GstRTSPStream * stream, GstBin * bin, priv->tee[i] = NULL; priv->funnel[i] = NULL; } + + for (l = priv->transport_sources; l; l = l->next) { + GstRTSPMulticastTransportSource *s = l->data; + g_slice_free (GstRTSPMulticastTransportSource, s); + } + g_list_free (priv->transport_sources); + priv->transport_sources = NULL; + gst_object_unref (priv->send_src[0]); priv->send_src[0] = NULL; -- 2.7.4