mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
media: allow for ipv6 sockets
This commit is contained in:
parent
17bb89f1fc
commit
6afa5be799
1 changed files with 10 additions and 4 deletions
|
@ -539,7 +539,7 @@ gst_rtsp_media_stream_rtcp (GstRTSPMediaStream * stream, GstBuffer * buffer)
|
||||||
|
|
||||||
/* Allocate the udp ports and sockets */
|
/* Allocate the udp ports and sockets */
|
||||||
static gboolean
|
static gboolean
|
||||||
alloc_udp_ports (GstRTSPMediaStream * stream)
|
alloc_udp_ports (GstRTSPMediaStream * stream, gboolean is_ipv6)
|
||||||
{
|
{
|
||||||
GstStateChangeReturn ret;
|
GstStateChangeReturn ret;
|
||||||
GstElement *udpsrc0, *udpsrc1;
|
GstElement *udpsrc0, *udpsrc1;
|
||||||
|
@ -547,6 +547,7 @@ alloc_udp_ports (GstRTSPMediaStream * stream)
|
||||||
gint tmp_rtp, tmp_rtcp;
|
gint tmp_rtp, tmp_rtcp;
|
||||||
guint count;
|
guint count;
|
||||||
gint rtpport, rtcpport, sockfd;
|
gint rtpport, rtcpport, sockfd;
|
||||||
|
const gchar *host;
|
||||||
|
|
||||||
udpsrc0 = NULL;
|
udpsrc0 = NULL;
|
||||||
udpsrc1 = NULL;
|
udpsrc1 = NULL;
|
||||||
|
@ -557,10 +558,15 @@ alloc_udp_ports (GstRTSPMediaStream * stream)
|
||||||
/* Start with random port */
|
/* Start with random port */
|
||||||
tmp_rtp = 0;
|
tmp_rtp = 0;
|
||||||
|
|
||||||
|
if (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
|
/* try to allocate 2 UDP ports, the RTP port should be an even
|
||||||
* number and the RTCP port should be the next (uneven) port */
|
* number and the RTCP port should be the next (uneven) port */
|
||||||
again:
|
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)
|
if (udpsrc0 == NULL)
|
||||||
goto no_udp_protocol;
|
goto no_udp_protocol;
|
||||||
g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, NULL);
|
g_object_set (G_OBJECT (udpsrc0), "port", tmp_rtp, NULL);
|
||||||
|
@ -596,7 +602,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate port+1 for RTCP now */
|
/* 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)
|
if (udpsrc1 == NULL)
|
||||||
goto no_udp_rtcp_protocol;
|
goto no_udp_rtcp_protocol;
|
||||||
|
|
||||||
|
@ -916,7 +922,7 @@ setup_stream (GstRTSPMediaStream * stream, guint idx, GstRTSPMedia * media)
|
||||||
/* allocate udp ports, we will have 4 of them, 2 for receiving RTP/RTCP and 2
|
/* allocate udp ports, we will have 4 of them, 2 for receiving RTP/RTCP and 2
|
||||||
* for sending RTP/RTCP. The sender and receiver ports are shared between the
|
* for sending RTP/RTCP. The sender and receiver ports are shared between the
|
||||||
* elements */
|
* elements */
|
||||||
if (!alloc_udp_ports (stream))
|
if (!alloc_udp_ports (stream, FALSE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* add the ports to the pipeline */
|
/* add the ports to the pipeline */
|
||||||
|
|
Loading…
Reference in a new issue