[vlc-devel] rtcp and udp port collision
Ross Finlayson
finlayson at live555.com
Sat Oct 23 00:19:31 CEST 2010
>Le vendredi 22 octobre 2010 14:29:20 Sébastien Escudier, vous avez écrit :
>> But, in the case I describe, we know DEST is taken by the client, which
>> may be on the same computer, so we shouldn't bind DEST-1. This is what's
>> happening with me.
>> And to avoid this, we could bind only even ports number for SRC.
>> Moreover, as noticed by David, this seems to be a common practice.
>
>I checked the VLC RTP output code. It ignores failure to create the RTCP
>socket (this is another bug). So it must be the client that fails.
>
>That would be live555, not VLC. This is pretty stupid. The client should
>allocate both RTP and RTCP ports *before* it contacts the server. Then, for
>lack of atomic multi-bind(), the client should run a live loop until it
>obtains a working pair.
I don't think that the LIVE555 code (used by the
RTSP client) is a problem; it does exactly what
you describe (see "liveMedia/MediaSession.cpp",
lines 610-673). Note, though, that before trying
to "bind()" a port to the new socket (to see if
it can be used), the code calls "setsockopt()" to
turn off SO_REUSEPORT. This is how it detects
whether the port number is in use elsewhere on
the same host.
This can work, of course, only if the *server*
also turns off SO_REUSEPORT when it tries to
allocate its own ports. Our RTSP server code
does this (look for "NoReuse" in
"liveMedia/OnDemandServerMediaSubsession.cpp" if
you care). But perhaps your RTSP server code
doesn't?
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the vlc-devel
mailing list