rtspsrc: require a destination for multicast

When setting up the multicast sockets, we need a destination address to listen
on or else we error.
This commit is contained in:
Wim Taymans 2010-03-09 17:53:32 +01:00
parent 574447b092
commit 8eb5c2c794

View file

@ -2279,17 +2279,24 @@ static gboolean
gst_rtspsrc_stream_configure_mcast (GstRTSPSrc * src, GstRTSPStream * stream,
GstRTSPTransport * transport, GstPad ** outpad)
{
gchar *uri;
gchar *uri, *destination;
gint min, max;
GST_DEBUG_OBJECT (src, "creating UDP sources for multicast");
/* we can remove the allocated UDP ports now */
gst_rtspsrc_stream_free_udp (stream);
/* creating UDP source */
if (transport->port.min != -1) {
uri = g_strdup_printf ("udp://%s:%d", transport->destination,
transport->port.min);
/* we need a destination now */
if (!(destination = transport->destination))
goto no_destination;
min = transport->port.min;
max = transport->port.max;
/* creating UDP source for RTP */
if (min != -1) {
uri = g_strdup_printf ("udp://%s:%d", destination, min);
stream->udpsrc[0] = gst_element_make_from_uri (GST_URI_SRC, uri, NULL);
g_free (uri);
if (stream->udpsrc[0] == NULL)
@ -2303,10 +2310,9 @@ gst_rtspsrc_stream_configure_mcast (GstRTSPSrc * src, GstRTSPStream * stream,
gst_element_set_state (stream->udpsrc[0], GST_STATE_PAUSED);
}
/* creating another UDP source */
if (transport->port.max != -1) {
uri = g_strdup_printf ("udp://%s:%d", transport->destination,
transport->port.max);
/* creating another UDP source for RTCP */
if (max != -1) {
uri = g_strdup_printf ("udp://%s:%d", destination, max);
stream->udpsrc[1] = gst_element_make_from_uri (GST_URI_SRC, uri, NULL);
g_free (uri);
if (stream->udpsrc[1] == NULL)
@ -2326,6 +2332,11 @@ no_element:
GST_DEBUG_OBJECT (src, "no UDP source element found");
return FALSE;
}
no_destination:
{
GST_DEBUG_OBJECT (src, "no destination found");
return FALSE;
}
}
/* configure the remainder of the UDP ports */