[vlc-devel] rtcp and udp port collision

Rémi Denis-Courmont remi at remlab.net
Fri Oct 22 13:03:23 CEST 2010

On Fri, 22 Oct 2010 10:31:34 +0200, Sébastien Escudier
<sebastien-devel at celeos.eu> wrote:
> I have a rtsp client and rtsp server on the same computer.
> The client binds port number a and a+1
> The server (vlc), in stream_out/rtcp.c line 79 binds port number a-1

No. The clients binds port DEST and DEST+1, the server binds port SRC and
SRC+1. As long as |DEST-SRC|>= 2, there is no problem.

Of course, there is a race condition if another process tries to bind port
DEST+1 or SRC+1 in the middle. This is impossible to fix. The IP stack
provides no way to atomically bind two consecutive ports. RTP/AVP was
designed with multicast in mind, in which case allocation of the
destination ports is not an issue. Using RTCP-mux is the only solution. But
RTCP-mux negotiation would need an as yet unwritten extension to the RTSP

Rémi Denis-Courmont

More information about the vlc-devel mailing list