[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 24 20:21:48 CET 2009
Hi,
On Tue, Jan 6, 2009 at 3:53 PM, Luca Barbato <lu_zero at gentoo.org> wrote:
> Ronald S. Bultje wrote:
>> On Tue, Jan 6, 2009 at 7:43 AM, Luca Barbato <lu_zero at gentoo.org> wrote:
>>> Ronald S. Bultje wrote:
>>>> When choosing TCP as a transport, RTP-compliant servers will
>>>> automatically select an interleave ID for each stream transmitted over
>>>> the TCP session. This property can then be used client-side to detect
>>>> which stream each packet belongs to. Somehow, Microsoft RTSP wants us
>>>> to request the ID client-side in the SETUP request.
>>>>
>>>> This patch adds support for this weird protocol construction...
>>> Looks ok but
>>>
>>> > ";unicast;interleaved=%d-%d",
>>>
>>> unicast isn't necessary, defining interleaved is part of the standard
>>> anyway.
>>
>> Without unicast it refuses to start here (server replies 461:
>> unsupported transport protocol).
>>
>> If you prefer, I can place the unicast alone under the if (WMS) and
>> place the interleave outside it so the default RTSP uses it also.
>
> Unnecessary doesn't mean wrong, I'd rather have as less special cases as
> possible.
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.
See attached patch, I hope that's OK.
Ronald
-------------- next part --------------
Index: ffmpeg-svn/libavformat/rtsp.c
===================================================================
--- ffmpeg-svn.orig/libavformat/rtsp.c 2009-01-23 20:04:52.000000000 -0500
+++ ffmpeg-svn/libavformat/rtsp.c 2009-01-24 14:19:22.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_REAL)
+ 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