[FFmpeg-devel] [PATCH] RTP source address filtering

Martin Storsjö martin
Wed Jan 5 22:49:07 CET 2011


Hi,

An issue that has come up every now and then is filtering of RTP packets 
depending on source address/port - that is, accepting only packets from 
the right source. This is discussed, among other places, in issue 1688.

Sam Creasey sent a good patch in September, that wasn't applied, though. 
His patch used recvfrom() and tried to match the sender address to what we 
had chosen to connect to. Since there isn't total consensus on whether 
this really is desired, it probably should be optional via some parameter.

The other day, I gave this a look and tried to polish up his patch for 
inclusion. Then I realized that instead of manually filtering the packets, 
we could just as well use connect() on the UDP socket to tell the OS which 
peer address/port we're trying to talk to, which would make the OS do the 
same, sparing us the filtering. (Doing connect() on UDP sockets is 
available since October, via the connect=1 parameter to udp urls.)

The attached patchset adds support for setting the connect parameter in 
udp_set_remote_url, for passing it through properly via the rtp protocol 
handler, and for a RTSP option (?filter_src) which enables this on the UDP 
sockets.

This solution, for enabling it on RTSP via a URL parameter, doesn't work 
as well for SDP played back from file though. Once we have working demuxer 
specific private options via AVOptions, that would be one solution. (I 
tried, but it isn't as easy to implement as for muxers, since the demuxers 
aren't known in advance due to probing and such...)

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rtpproto-Allow-specifying-the-connect-option-passed-.patch
Type: text/x-diff
Size: 3476 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110105/b4b7f64f/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-udp-Allow-specifying-the-connect-option-in-udp_set_r.patch
Type: text/x-diff
Size: 2725 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110105/b4b7f64f/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-rtsp-Allow-requesting-of-filtering-of-source-packets.patch
Type: text/x-diff
Size: 3154 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110105/b4b7f64f/attachment-0002.patch>



More information about the ffmpeg-devel mailing list