diff rtsp.c @ 4332:0d776969b708 libavformat

Fix the Transport: line in the SETUP request so that it works with WMS servers when trying to set up a session over TCP: - add the interleave property - add unicast, only for WMS (since it is normally only UDP, but WMS expects it for UDP and TCP) - add mode=play See discussion in "[PATCH] RTSP-MS 9/15: add interleave property to the TCP transport line of the SETUP request" thread on mailinglist.
author rbultje
date Sun, 01 Feb 2009 13:37:45 +0000
parents f49e5d92ab26
children 3ae604db67e0
line wrap: on
line diff
--- a/rtsp.c	Sun Feb 01 02:00:19 2009 +0000
+++ b/rtsp.c	Sun Feb 01 13:37:45 2009 +0000
@@ -886,7 +886,7 @@
                     int lower_transport, const char *real_challenge)
 {
     RTSPState *rt = s->priv_data;
-    int j, i, err;
+    int j, i, err, interleave = 0;
     RTSPStream *rtsp_st;
     RTSPHeader reply1, *reply = &reply1;
     char cmd[2048];
@@ -943,14 +943,21 @@
         /* RTP/TCP */
         else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
             snprintf(transport, sizeof(transport) - 1,
-                     "%s/TCP", trans_pref);
+                     "%s/TCP;", trans_pref);
+            if (rt->server_type == RTSP_SERVER_WMS)
+                av_strlcat(transport, "unicast;", sizeof(transport));
+            av_strlcatf(transport, sizeof(transport),
+                        "interleaved=%d-%d",
+                        interleave, interleave + 1);
+            interleave += 2;
         }
 
         else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
             snprintf(transport, sizeof(transport) - 1,
                      "%s/UDP;multicast", trans_pref);
         }
-        if (rt->server_type == RTSP_SERVER_REAL)
+        if (rt->server_type == RTSP_SERVER_REAL ||
+            rt->server_type == RTSP_SERVER_WMS)
             av_strlcat(transport, ";mode=play", sizeof(transport));
         snprintf(cmd, sizeof(cmd),
                  "SETUP %s RTSP/1.0\r\n"