[Live-devel] rtsp session via Internet - NAT problem
Erik van Dort
erik.van.dort at bluewin.ch
Wed Nov 12 14:32:22 PST 2008
Hi,
My system consists of three nodes at different locations on the Internet:
IP-camera <---> LAN1 <---> ADSL-router/firewall/NAT-1 <---> INTERNET
VLC Server <---> LAN2 <---> ADSL-router/firewall/NAT-2 <---> INTERNET
VLC Client <---> LAN3 <---> ADSL-router/firewall/NAT-3 <---> INTERNET
The VLC Server connects to the IP camera using the following command:
vlc -I dummy -vvv rtsp://xxxx.dyndns.org:554/mpeg4/media.amp --sout
"#rtp{sdp=rtsp://:8081/test.sdp}"
This works fine. The rtsp session setup shows a.o. the following:
Sending request: SETUP rtsp://xxxx.dyndns.org:554/mpeg4/media.amp/trackID=1
RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=61954-61955
User-Agent: openRTSP (LIVE555 Streaming Media v2007.12.06)
Received SETUP response: RTSP/1.0 200 OK
CSeq: 3
Session: 0700422311;timeout=60
Transport:
RTP/AVP;unicast;client_port=61954-61955;server_port=50018-50019;ssrc=3CFA4EEC;mode="PLAY"
As the next step, I connect the VLC client to the VLC server by opening
the following network stream in a VLC player:
rtsp://yyyy.dyndns.org:8081/test.sdp
This does not work. Testing the session setup to the VLC Server with the
openRTSP tool shows the following:
Sending request: SETUP
rtsp://yyyy.dyndns.org:8081/test.sdp/trackID=0 RTSP/1.0
CSeq: 3
Transport: RTP/AVP;unicast;client_port=1232-1233
User-Agent: openRTSP (LIVE555 Streaming Media v2008.11.04)
Received SETUP response: RTSP/1.0 200 OK
Transport: RTP/AVP/UDP;client_port=1232-1233
Server: VLC Server
Content-Length: 0
Cseq: 3
Cache-Control: no-cache
Session: 101027544
Comparing the session setup between the IP camera and the VLC server on
one hand, and the VLC Server and VLC client on the other hand, I see one
major difference:
IP-camera <---> VLC Server: as a response to the SETUP request both the
client_port range and the server_port range are communicated.
VLC Server <---> VLC Client: as a response to the SETUP request only the
client_port range is communicated.
NAT devices interpet SETUP request/response packets in order to build
dynamic NAT rules. As a consequence:
1) once the IP-camera starts streaming UDP packets to the VLC Server,
the NAT device at the VLC Server location knows that incoming UDP
packets with source ports 50018-50019 need to be forwarded to ports
61954-61955 of the VLC Server host, because this information was
communicated in the SETUP response.
2) after the VLC client has established an rtsp session with the VLC
Server, it starts waiting for UDP packets. But the NAT device at the VLC
Client location does not know with which source ports these UDP packets
will be coming in, because the server_port range has not been
communicated. Therefore, the NAT device at the Client location will
discard the UDP packets that are sent by the VLC server, and the VLC
Client ends up with a message like "no data received for over 10
seconds", eventually ending up with "nothing to play".
Note that this system works properly if all nodes are located within the
same LAN (no NAT devices involved).
Does anybody know if there is a way to get the server_port range being
communicated in a rtsp session setup?
Cheers........
Erik
--
EvD
More information about the live-devel
mailing list