Commit db3c4e7f authored by Wim Taymans's avatar Wim Taymans
Browse files

rtspsrc: fall back to SDP ports instead of server_port

In multicast, fall back to the ports in the SDP instead of the server_port
attribute as this is more in line with the RFC.
parent 4e1ced0a
...@@ -924,9 +924,13 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) ...@@ -924,9 +924,13 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
* container and we only need to add one pad. */ * container and we only need to add one pad. */
if (find_stream (src, &stream->pt, (gpointer) find_stream_by_pt)) { if (find_stream (src, &stream->pt, (gpointer) find_stream_by_pt)) {
stream->container = TRUE; stream->container = TRUE;
GST_DEBUG ("found another stream with pt %d, marking as container",
stream->pt);
} }
} }
} }
/* collect port number */
stream->port = gst_sdp_media_get_port (media);
/* get control url to construct the setup url. The setup url is used to /* get control url to construct the setup url. The setup url is used to
* configure the transport of the stream and is used to identity the stream in * configure the transport of the stream and is used to identity the stream in
...@@ -935,6 +939,7 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) ...@@ -935,6 +939,7 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx)
GST_DEBUG_OBJECT (src, "stream %d, (%p)", stream->id, stream); GST_DEBUG_OBJECT (src, "stream %d, (%p)", stream->id, stream);
GST_DEBUG_OBJECT (src, " pt: %d", stream->pt); GST_DEBUG_OBJECT (src, " pt: %d", stream->pt);
GST_DEBUG_OBJECT (src, " port: %d", stream->port);
GST_DEBUG_OBJECT (src, " container: %d", stream->container); GST_DEBUG_OBJECT (src, " container: %d", stream->container);
GST_DEBUG_OBJECT (src, " caps: %" GST_PTR_FORMAT, stream->caps); GST_DEBUG_OBJECT (src, " caps: %" GST_PTR_FORMAT, stream->caps);
GST_DEBUG_OBJECT (src, " control: %s", GST_STR_NULL (control_url)); GST_DEBUG_OBJECT (src, " control: %s", GST_STR_NULL (control_url));
...@@ -2393,12 +2398,10 @@ gst_rtspsrc_get_transport_info (GstRTSPSrc * src, GstRTSPStream * stream, ...@@ -2393,12 +2398,10 @@ gst_rtspsrc_get_transport_info (GstRTSPSrc * src, GstRTSPStream * stream,
*max = transport->port.max; *max = transport->port.max;
if (*min == -1 && *max == -1) { if (*min == -1 && *max == -1) {
/* then try from SDP */ /* then try from SDP */
} if (stream->port != 0) {
if (*min == -1 && *max == -1) { *min = stream->port;
/* some bad servers use the server_port attribute for multicast, try to handle *max = stream->port + 1;
* those cases too here */ }
*min = transport->server_port.min;
*max = transport->server_port.max;
} }
} }
...@@ -2414,6 +2417,7 @@ gst_rtspsrc_get_transport_info (GstRTSPSrc * src, GstRTSPStream * stream, ...@@ -2414,6 +2417,7 @@ gst_rtspsrc_get_transport_info (GstRTSPSrc * src, GstRTSPStream * stream,
*destination = gst_rtsp_connection_get_ip (src->connection); *destination = gst_rtsp_connection_get_ip (src->connection);
} }
if (min && max) { if (min && max) {
/* for unicast we only expect the ports here */
*min = transport->server_port.min; *min = transport->server_port.min;
*max = transport->server_port.max; *max = transport->server_port.max;
} }
......
...@@ -117,6 +117,7 @@ struct _GstRTSPStream { ...@@ -117,6 +117,7 @@ struct _GstRTSPStream {
/* state */ /* state */
gint pt; gint pt;
guint port;
gboolean container; gboolean container;
/* original control url */ /* original control url */
gchar *control_url; gchar *control_url;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment