From ffcd173c091c375ce0197c730f804b25538e3d29 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 13 Jul 2017 14:46:55 -0400 Subject: [PATCH] rtspsrc: Handle TCP as lower transport with RTSP 2.0 Meaning that the interleave fields have to be updated as if streams setup was working when using pipelined setup request. Otherwise there is a mismatch between the server channel count and our own. This also makes RTSP 2.0 over HTTP working. https://bugzilla.gnome.org/show_bug.cgi?id=781446 --- gst/rtsp/gstrtspsrc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 9facda8f68..55f9d93d58 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -6082,10 +6082,14 @@ gst_rtspsrc_prepare_transports (GstRTSPStream * stream, gchar ** transports, g_string_append_printf (str, "%d", src->free_channel); else if (next[3] == '2') g_string_append_printf (str, "%d", src->free_channel + 1); + } p = next + 4; } + if (src->version >= GST_RTSP_VERSION_2_0) + src->free_channel += 2; + /* append final part */ g_string_append (str, p); @@ -6202,10 +6206,12 @@ gst_rtsp_src_setup_stream_from_response (GstRTSPSrc * src, if (protocols) *protocols = GST_RTSP_LOWER_TRANS_TCP; src->interleaved = TRUE; - /* update free channels */ - src->free_channel = MAX (transport.interleaved.min, src->free_channel); - src->free_channel = MAX (transport.interleaved.max, src->free_channel); - src->free_channel++; + if (src->version < GST_RTSP_VERSION_2_0) { + /* update free channels */ + src->free_channel = MAX (transport.interleaved.min, src->free_channel); + src->free_channel = MAX (transport.interleaved.max, src->free_channel); + src->free_channel++; + } break; case GST_RTSP_LOWER_TRANS_UDP_MCAST: /* only allow multicast for other streams */ @@ -6331,7 +6337,7 @@ gst_rtspsrc_setup_streams_end (GstRTSPSrc * src, gboolean async) gst_rtsp_src_receive_response (src, conninfo, &response, NULL); gst_rtsp_src_setup_stream_from_response (src, stream, - &response, NULL, 1, NULL, NULL); + &response, NULL, 0, NULL, NULL); } return GST_RTSP_OK; @@ -6505,7 +6511,6 @@ gst_rtspsrc_setup_streams_start (GstRTSPSrc * src, gboolean async) } GST_DEBUG_OBJECT (src, "transport is now %s", GST_STR_NULL (transports)); - /* create SETUP request */ res = gst_rtspsrc_init_request (src, &request, GST_RTSP_SETUP,