From ef4d2901aa6321dfe79d6003869f817890359414 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 6 May 2010 16:52:26 +0200 Subject: [PATCH] rtspsrc: use the SDP connection info in multicast Parse the connection info from the SDP. When we need to configure the multicast destination, fall back to the SDP connection info when the transport did not specify a destination and ttl. Fixes #617537 --- gst/rtsp/gstrtspsrc.c | 25 +++++++++++++++++++++---- gst/rtsp/gstrtspsrc.h | 4 ++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 01f1d9a6f3..e06284f886 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -838,7 +838,10 @@ gst_rtspsrc_do_stream_connection (GstRTSPSrc * src, GstRTSPStream * stream, else return; - /* FIXME check for multicast */ + /* save address, FIXME, check for multicast */ + g_free (stream->destination); + stream->destination = g_strdup (conn->address); + stream->ttl = conn->ttl; } /* Go over the connections for a stream. @@ -985,6 +988,7 @@ gst_rtspsrc_stream_free (GstRTSPSrc * src, GstRTSPStream * stream) if (stream->caps) gst_caps_unref (stream->caps); + g_free (stream->destination); g_free (stream->control_url); g_free (stream->setup_url); @@ -2387,8 +2391,10 @@ gst_rtspsrc_stream_configure_mcast (GstRTSPSrc * src, GstRTSPStream * stream, gst_rtspsrc_stream_free_udp (stream); /* we need a destination now */ - if (!(destination = transport->destination)) - goto no_destination; + if (!(destination = transport->destination)) { + if (!(destination = stream->destination)) + goto no_destination; + } min = transport->port.min; max = transport->port.max; @@ -2509,13 +2515,18 @@ gst_rtspsrc_stream_configure_udp_sinks (GstRTSPSrc * src, gint rtp_port, rtcp_port, sockfd = -1; const gchar *destination; gchar *uri, *name; + guint ttl = 0; /* get host and port */ if (transport->lower_transport == GST_RTSP_LOWER_TRANS_UDP_MCAST) { rtp_port = transport->port.min; rtcp_port = transport->port.max; /* multicast destination */ - destination = transport->destination; + if (!(destination = transport->destination)) + destination = stream->destination; + /* get ttl */ + if (!(ttl = transport->ttl)) + ttl = stream->ttl; } else { rtp_port = transport->server_port.min; rtcp_port = transport->server_port.max; @@ -2540,7 +2551,10 @@ gst_rtspsrc_stream_configure_udp_sinks (GstRTSPSrc * src, if (stream->udpsink[0] == NULL) goto no_sink_element; + /* don't join multicast group, we will have the source socket do that */ g_object_set (G_OBJECT (stream->udpsink[0]), "auto-multicast", FALSE, NULL); + if (ttl > 0) + g_object_set (G_OBJECT (stream->udpsink[0]), "ttl", ttl, NULL); g_object_set (G_OBJECT (stream->udpsink[0]), "loop", FALSE, NULL); /* no sync or async state changes needed */ g_object_set (G_OBJECT (stream->udpsink[0]), "sync", FALSE, "async", FALSE, @@ -2594,7 +2608,10 @@ gst_rtspsrc_stream_configure_udp_sinks (GstRTSPSrc * src, if (stream->udpsink[1] == NULL) goto no_sink_element; + /* don't join multicast group, we will have the source socket do that */ g_object_set (G_OBJECT (stream->udpsink[1]), "auto-multicast", FALSE, NULL); + if (ttl > 0) + g_object_set (G_OBJECT (stream->udpsink[0]), "ttl", ttl, NULL); g_object_set (G_OBJECT (stream->udpsink[1]), "loop", FALSE, NULL); /* no sync needed */ g_object_set (G_OBJECT (stream->udpsink[1]), "sync", FALSE, NULL); diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index 6dc1c965d1..eb4a2f8549 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -130,6 +130,10 @@ struct _GstRTSPStream { guint as_bandwidth; guint rs_bandwidth; guint rr_bandwidth; + + /* destination */ + gchar *destination; + guint ttl; }; /**