rtsp-stream: Don't require presence of sinks in _get_*_socket()

Transport specific sink elements are added to the pipeline
in PLAY request and sockets are already created in SETUP so
it's actually wrong to require the presence of sinks in
_get_*_socket() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=793441
This commit is contained in:
Patricia Muscalu 2018-03-13 11:10:35 +01:00 committed by Sebastian Dröge
parent dcb4533fed
commit 4007050335

View file

@ -4039,19 +4039,20 @@ gst_rtsp_stream_get_rtp_socket (GstRTSPStream * stream, GSocketFamily family)
{ {
GstRTSPStreamPrivate *priv = stream->priv; GstRTSPStreamPrivate *priv = stream->priv;
GSocket *socket; GSocket *socket;
const gchar *name;
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 ||
family == G_SOCKET_FAMILY_IPV6, NULL); family == G_SOCKET_FAMILY_IPV6, NULL);
g_return_val_if_fail (priv->udpsink[0], NULL);
g_mutex_lock (&priv->lock);
if (family == G_SOCKET_FAMILY_IPV6) if (family == G_SOCKET_FAMILY_IPV6)
name = "socket-v6"; socket = priv->socket_v6[0];
else else
name = "socket"; socket = priv->socket_v4[0];
g_object_get (priv->udpsink[0], name, &socket, NULL); if (socket != NULL)
socket = g_object_ref (socket);
g_mutex_unlock (&priv->lock);
return socket; return socket;
} }
@ -4071,21 +4072,22 @@ gst_rtsp_stream_get_rtp_socket (GstRTSPStream * stream, GSocketFamily family)
GSocket * GSocket *
gst_rtsp_stream_get_rtcp_socket (GstRTSPStream * stream, GSocketFamily family) gst_rtsp_stream_get_rtcp_socket (GstRTSPStream * stream, GSocketFamily family)
{ {
GstRTSPStreamPrivate *priv = gst_rtsp_stream_get_instance_private (stream); GstRTSPStreamPrivate *priv = stream->priv;
GSocket *socket; GSocket *socket;
const gchar *name;
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 ||
family == G_SOCKET_FAMILY_IPV6, NULL); family == G_SOCKET_FAMILY_IPV6, NULL);
g_return_val_if_fail (priv->udpsink[1], NULL);
g_mutex_lock (&priv->lock);
if (family == G_SOCKET_FAMILY_IPV6) if (family == G_SOCKET_FAMILY_IPV6)
name = "socket-v6"; socket = priv->socket_v6[1];
else else
name = "socket"; socket = priv->socket_v4[1];
g_object_get (priv->udpsink[1], name, &socket, NULL); if (socket != NULL)
socket = g_object_ref (socket);
g_mutex_unlock (&priv->lock);
return socket; return socket;
} }
@ -4104,21 +4106,22 @@ GSocket *
gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream * stream, gst_rtsp_stream_get_rtp_multicast_socket (GstRTSPStream * stream,
GSocketFamily family) GSocketFamily family)
{ {
GstRTSPStreamPrivate *priv = gst_rtsp_stream_get_instance_private (stream); GstRTSPStreamPrivate *priv = stream->priv;
GSocket *socket; GSocket *socket;
const gchar *name;
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 ||
family == G_SOCKET_FAMILY_IPV6, NULL); family == G_SOCKET_FAMILY_IPV6, NULL);
g_return_val_if_fail (priv->mcast_udpsink[0], NULL);
g_mutex_lock (&priv->lock);
if (family == G_SOCKET_FAMILY_IPV6) if (family == G_SOCKET_FAMILY_IPV6)
name = "socket-v6"; socket = priv->mcast_socket_v6[0];
else else
name = "socket"; socket = priv->mcast_socket_v4[0];
g_object_get (priv->mcast_udpsink[0], name, &socket, NULL); if (socket != NULL)
socket = g_object_ref (socket);
g_mutex_unlock (&priv->lock);
return socket; return socket;
} }
@ -4137,21 +4140,22 @@ GSocket *
gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream * stream, gst_rtsp_stream_get_rtcp_multicast_socket (GstRTSPStream * stream,
GSocketFamily family) GSocketFamily family)
{ {
GstRTSPStreamPrivate *priv = gst_rtsp_stream_get_instance_private (stream); GstRTSPStreamPrivate *priv = stream->priv;
GSocket *socket; GSocket *socket;
const gchar *name;
g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL); g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), NULL);
g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 || g_return_val_if_fail (family == G_SOCKET_FAMILY_IPV4 ||
family == G_SOCKET_FAMILY_IPV6, NULL); family == G_SOCKET_FAMILY_IPV6, NULL);
g_return_val_if_fail (priv->mcast_udpsink[1], NULL);
g_mutex_lock (&priv->lock);
if (family == G_SOCKET_FAMILY_IPV6) if (family == G_SOCKET_FAMILY_IPV6)
name = "socket-v6"; socket = priv->mcast_socket_v6[1];
else else
name = "socket"; socket = priv->mcast_socket_v4[1];
g_object_get (priv->mcast_udpsink[1], name, &socket, NULL); if (socket != NULL)
socket = g_object_ref (socket);
g_mutex_unlock (&priv->lock);
return socket; return socket;
} }