From 574447b09214d85e6ddc9a406987e928a9c674f3 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 9 Mar 2010 17:52:35 +0100 Subject: [PATCH] rtspsrc: handle ipv6 listening ports when needed Add some code to make udpsrc listen on an ipv6 address when needed. The detection of IPV6 is not yet implemented. --- gst/rtsp/gstrtspsrc.c | 10 ++++++++-- gst/rtsp/gstrtspsrc.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 5a60593..cbd2a99 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -1272,6 +1272,7 @@ gst_rtspsrc_alloc_udp_ports (GstRTSPStream * stream, GstElement *udpsrc0, *udpsrc1; gint tmp_rtp, tmp_rtcp; guint count; + const gchar *host; src = stream->parent; @@ -1282,10 +1283,15 @@ gst_rtspsrc_alloc_udp_ports (GstRTSPStream * stream, /* Start with random port */ tmp_rtp = 0; + if (stream->is_ipv6) + host = "udp://[::0]"; + else + host = "udp://0.0.0.0"; + /* try to allocate 2 UDP ports, the RTP port should be an even * number and the RTCP port should be the next (uneven) port */ again: - udpsrc0 = gst_element_make_from_uri (GST_URI_SRC, "udp://0.0.0.0", NULL); + udpsrc0 = gst_element_make_from_uri (GST_URI_SRC, host, NULL); if (udpsrc0 == NULL) goto no_udp_protocol; g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, NULL); @@ -1330,7 +1336,7 @@ again: } /* allocate port+1 for RTCP now */ - udpsrc1 = gst_element_make_from_uri (GST_URI_SRC, "udp://0.0.0.0", NULL); + udpsrc1 = gst_element_make_from_uri (GST_URI_SRC, host, NULL); if (udpsrc1 == NULL) goto no_udp_rtcp_protocol; diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index 18646c3..d613490 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -106,6 +106,7 @@ struct _GstRTSPStream { /* our udp sources */ GstElement *udpsrc[2]; GstPad *blockedpad; + gboolean is_ipv6; /* our udp sinks back to the server */ GstElement *udpsink[2]; -- 2.7.4