mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
455f53c896
commit
574447b092
2 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Reference in a new issue