[FFmpeg-devel] [PATCH] Send NAT punching packets when starting to read an RTP/UDP stream

Luca Abeni lucabe72
Thu Feb 11 10:59:39 CET 2010

Martin Storsj? wrote:
> On Thu, 11 Feb 2010, Luca Abeni wrote:
>> Martin Storsj? wrote:
>> [...]
>>>> The packets pass through the NAT, and arrive to S from a different source
>>>> IP (the NAT public IP) and a different source port (the port on which the
>>>> NAT machine remaps the "private" source port used by C).
>>> If the NAT changes the port numbers, this probably doesn't work. Usually,
>>> they don't change the port numbers, though. The "source port, destination
>>> port, destination ip" tuple is often enough to keep track of connections,
>>> mapping them uniquely to the private IP of C.
>> But if you have two NATed clients sending packets from the same source
>> port, won't the source port of at least one of the two be changed?
>> Consider two ffmpeg clients in the local network, which want to
>> receive the same stream...
> No, as long as the destination port or IP is different, it's ok for the 
> linux conntrack/nat system, it seems.

Well, maybe the NATs I've seen in the past have been configured by paranoid
people ;-)
Anyway, if this works in a reasonable amount of cases (I suspect it will
work on most of the symmetric NATs?) I have no objections.

But maybe the comment before rtp_send_punch_packets() can be expanded
to clarify that this is not a standard thing (BTW, does anyone know
if there is any standard solution for RTSP/RTP through NATs?) and that
it works if the source port is not remapped.


More information about the ffmpeg-devel mailing list