[FFmpeg-devel] [PATCH] RTSP-MS 9/15: add interleave property to the TCP transport line of the SETUP request

Ronald S. Bultje rsbultje
Sat Jan 31 17:25:10 CET 2009


Hi Luca,

On Sat, Jan 31, 2009 at 11:19 AM, Luca Barbato <lu_zero at gentoo.org> wrote:
> Ronald S. Bultje wrote:
>> OK, RTP accepts with or without unicast, Real only without and WMS
>> only with. UDP currently does unicast except for Real, so I added the
>> same case for TCP as well. Interleave is supported by all and is thus
>> outside of any conditional clause.
>
> It shouldn't work -> unicast means udp, interleaved means tcp (well any
> other transport in theory but right now just tcp is supported and
> specified in rfcs)

Odd, I guess "unexpected" fields are just discarded then, apparently
except by WMS or Real (gosh, what a surprise :-) ), which either wants
unicast for both TCP *and* UDP (WMS) or doesn't want them at all
(Real), neither of which is correct.

Attached patch (probably?) does the correct thing. Sorry it has to be
this way, but MS/TCP really does require the unicast property in the
TCP transport, it fails without. All I'm doing is try to make it work
in ffplay. :-).

Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c	2009-01-31 11:21:13.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.c	2009-01-31 11:21:47.000000000 -0500
@@ -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"



More information about the ffmpeg-devel mailing list