Search code examples
gstreamergstreamer-1.0

which client ports are used by rtspsrc if it not specified on the port-range property


I have a request from the network guy which RTSP client ports are used by the rtspsrc? We didn't set the port-range property on the rtspsrc element.

Can anybody tell me which ports are used the rtspsrc if this property is not set? (TCP/UDP). Is there any min max by default or is it the whole range from 1 - 65535.

Thank you


Solution

  • I believe this is just the OS specific, dynamic port range. For example on Linux this would be:

    cat /proc/sys/net/ipv4/ip_local_port_range
    32768   60999
    

    I have no idea how up to date this is, but seems to be generally correct:

    https://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html

    Now, your network admin is probably not going to want to map every single high level port (32768->60999) to your one service. What you'll probably want to do is go ahead and use the port-range property (say 33050->33060) and pass that range over to your network admin. Ask them to create a firewall rule to map that public range of ports to your machine. You should probably only need a few ports for each stream you use.

    To perhaps kinda visualize this, say you ask for the above port range:

    PUBLIC RTSP SERVER "sometestsrv.com"
    554 //initial call to handshake for RTSP made here
    50000 //RTP port for client 1 (somecompany.com:33050)
    50001 //RTCP port for client 1 (somecompany.com:33051)
    50100 //RTP port for client 2
    50101 //RTCP port for client 2
    ...
    
    PUBLIC IP FOR YOUR COMPANY "somecompany.com"
    33050 //RTP port matching sometestsrv.com:50000
    33051 //RTCP port matching sometestsrv.com:50001
    
    YOUR SERVER "192.168.1.33" w/rtspsrc INSIDE "somecompany.com"
    33050 //RTP port matching sometestsrv.com:50000
    33051 //RTCP port matching sometestsrv.com:50001