mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 13:08:49 +00:00
rtsp-stream: added function for RTP/RTCP socket configuration
Code refactoring: configure RTP and RTCP sockets for UDP sinks in a separate function. https://bugzilla.gnome.org/show_bug.cgi?id=757488
This commit is contained in:
parent
6b6970ab23
commit
b26c16c824
1 changed files with 19 additions and 8 deletions
|
@ -1021,12 +1021,11 @@ different_address:
|
|||
}
|
||||
|
||||
/* must be called with lock */
|
||||
static gboolean
|
||||
create_and_configure_udpsinks (GstRTSPStream * stream, GSocket * rtp_socket,
|
||||
static void
|
||||
set_sockets_for_udpsinks (GstRTSPStream * stream, GSocket * rtp_socket,
|
||||
GSocket * rtcp_socket, GSocketFamily family)
|
||||
{
|
||||
GstRTSPStreamPrivate *priv = stream->priv;
|
||||
GstElement *udpsink0, *udpsink1;
|
||||
const gchar *multisink_socket;
|
||||
|
||||
if (family == G_SOCKET_FAMILY_IPV6)
|
||||
|
@ -1034,6 +1033,19 @@ create_and_configure_udpsinks (GstRTSPStream * stream, GSocket * rtp_socket,
|
|||
else
|
||||
multisink_socket = "socket";
|
||||
|
||||
g_object_set (G_OBJECT (priv->udpsink[0]), multisink_socket, rtp_socket,
|
||||
NULL);
|
||||
g_object_set (G_OBJECT (priv->udpsink[1]), multisink_socket, rtcp_socket,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* must be called with lock */
|
||||
static gboolean
|
||||
create_and_configure_udpsinks (GstRTSPStream * stream)
|
||||
{
|
||||
GstRTSPStreamPrivate *priv = stream->priv;
|
||||
GstElement *udpsink0, *udpsink1;
|
||||
|
||||
udpsink0 = NULL;
|
||||
udpsink1 = NULL;
|
||||
|
||||
|
@ -1077,9 +1089,6 @@ create_and_configure_udpsinks (GstRTSPStream * stream, GSocket * rtp_socket,
|
|||
g_object_set (G_OBJECT (udpsink0), "loop", FALSE, NULL);
|
||||
g_object_set (G_OBJECT (udpsink1), "loop", FALSE, NULL);
|
||||
|
||||
g_object_set (G_OBJECT (udpsink0), multisink_socket, rtp_socket, NULL);
|
||||
g_object_set (G_OBJECT (udpsink1), multisink_socket, rtcp_socket, NULL);
|
||||
|
||||
/* update the dscp qos field in the sinks */
|
||||
update_dscp_qos (stream);
|
||||
|
||||
|
@ -1236,10 +1245,12 @@ again:
|
|||
if (rtpport != tmp_rtp || rtcpport != tmp_rtcp)
|
||||
goto port_error;
|
||||
|
||||
if (!create_and_configure_udpsinks (stream, rtp_socket, rtcp_socket,
|
||||
family))
|
||||
if (!create_and_configure_udpsinks (stream))
|
||||
goto no_udp_protocol;
|
||||
|
||||
/* set RTP and RTCP sockets */
|
||||
set_sockets_for_udpsinks (stream, rtp_socket, rtcp_socket, family);
|
||||
|
||||
/* we keep these elements, we will further configure them when the
|
||||
* client told us to really use the UDP ports. */
|
||||
udpsrc_out[0] = udpsrc0;
|
||||
|
|
Loading…
Reference in a new issue