[FFmpeg-devel] [PATCH] rtsp - alternate protocol

Michael Niedermayer michaelni
Fri Dec 28 16:25:01 CET 2007


On Fri, Dec 28, 2007 at 07:49:39AM -0500, Ronald S. Bultje wrote:
> Hi,
> 
> attached patch allows the rtsp module to retry with alternate protocols if
> the first try fails. This allows the default setup to work with both
> UDP-only and TCP-only servers, even if the default is set to the wrong one.
> 
> Ronald

> Index: ffmpeg/libavformat/rtsp.c
> ===================================================================
> --- ffmpeg.orig/libavformat/rtsp.c	2007-12-28 07:23:00.000000000 -0500
> +++ ffmpeg/libavformat/rtsp.c	2007-12-28 07:46:14.000000000 -0500
> @@ -1025,6 +1025,7 @@
>          transport[0] = '\0';
>  
>          /* RTP/UDP */
> +retry_protocol:
>          if (protocol_mask & (1 << RTSP_PROTOCOL_RTP_UDP)) {
>              char buf[256];
>  
> @@ -1079,6 +1080,14 @@
>                   rtsp_st->control_url, res, csum, transport,
>                   rt->session_id);
>          rtsp_send_cmd(s, cmd, reply, NULL);
> +        if (reply->status_code == 461 /* Unsupported protocol */ && i == 0 &&
> +            protocol_mask == rtsp_default_protocols &&
> +            (protocol_mask == (1 << RTSP_PROTOCOL_RTP_UDP) ||
> +             protocol_mask == (1 << RTSP_PROTOCOL_RTP_TCP))) {
> +            protocol_mask = (protocol_mask == (1 << RTSP_PROTOCOL_RTP_UDP)) ?
> +                (1 << RTSP_PROTOCOL_RTP_TCP) : (1 << RTSP_PROTOCOL_RTP_UDP);
> +            goto retry_protocol;
> +        } else

this code looks (very) buggy, i think theres no gurantee that
protocol_mask == rtsp_default_protocols at the begin
also if protocol_mask is either one or the other then its clear that only that
should be tried
to try both protocol_mask would be 3 at least half of the code in rtsp.c
makes me think thats intended, the other half makes me think that 
protocol_mask should not be a bitmask but rather equal to 0 or 1 for UDP/TCP

either way rtsp_default_protocols should be droped its redundant and a mess
also it doesnt work on some OSs with PIC after -Bsymbolic has been added,
not that it did work before on all ...
Thats of course unrelated to the patch but the patch depends on 
rtsp_default_protocols which shouldnt be there at all ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071228/4e6f0d5f/attachment.pgp>



More information about the ffmpeg-devel mailing list