[FFmpeg-devel] [PATCH] Use the actual RTSP peer IP for RTP sessions

Martin Storsjö martin
Mon Mar 8 11:08:29 CET 2010


Hi,

If communicating with an RTSP server whose host name can resolve to more 
than one IP, the current RTSP (de)muxer has some problems. The host name 
parsed from the rtsp url is given as such to the rtp protocol handlers, 
which themselves resolve the host name to an IP address again - not 
necessarily the same as the RTSP control channel is connected to.

The most obvious example of this is localhost, which can resolve to either 
127.0.0.1 or ::1. The tcp protocol tries both and connects to whichever 
the server actually listens to, but the underlying UDP protocol in RTP 
can't probe things in the same way and simply chooses the first one 
returned.

Therefore, once connected over TCP, replace the host name with the actual 
numerical IP address that we're connected to.

The IP address is also present in the SDP, so the 
AVFormatContext->filename field must be temporarily changed to contain an 
URL with the numerical IP, but later changed back to the originally 
requested url. This feels a bit messy, though.

RTSP signals the virtual host that's requested through including the whole 
URL in the command (compared to a separate Host: header as in HTTP), so we 
must retain the originally requested host instead of the IP there.

Regards,
// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Resolve-and-use-the-actual-IP-address-of-the-peer-we.patch
Type: text/x-diff
Size: 1678 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100308/ec1d0c77/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Use-the-actual-peer-IP-for-choosing-SDP-destination-.patch
Type: text/x-diff
Size: 2308 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100308/ec1d0c77/attachment-0001.patch>



More information about the ffmpeg-devel mailing list