Browse Source

initialize udp listeners only if udp is enabled

pull/80/head
aler9 5 years ago
parent
commit
3c95dd0cdb
  1. 5
      main.go
  2. 7
      rtsp-simple-server.yml

5
main.go

@ -252,6 +252,7 @@ func newProgram(args []string, stdin io.Reader) (*program, error) { @@ -252,6 +252,7 @@ func newProgram(args []string, stdin io.Reader) (*program, error) {
return nil, err
}
if _, ok := conf.protocolsParsed[gortsplib.StreamProtocolUdp]; ok {
p.serverRtcp, err = newServerUdp(p, conf.RtcpPort, gortsplib.StreamTypeRtcp)
if err != nil {
return nil, err
@ -261,6 +262,7 @@ func newProgram(args []string, stdin io.Reader) (*program, error) { @@ -261,6 +262,7 @@ func newProgram(args []string, stdin io.Reader) (*program, error) {
if err != nil {
return nil, err
}
}
for name, confp := range conf.Paths {
if confp.RunOnInit != "" {
@ -545,8 +547,11 @@ outer: @@ -545,8 +547,11 @@ outer:
}
p.serverRtsp.close()
if _, ok := p.conf.protocolsParsed[gortsplib.StreamProtocolUdp]; ok {
p.serverRtcp.close()
p.serverRtp.close()
}
for c := range p.clients {
c.conn.NetConn().Close()

7
rtsp-simple-server.yml

@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
protocols: [udp, tcp]
# port of the TCP RTSP listener
rtspPort: 8554
# port of the UDP RTP listener
# port of the UDP RTP listener (used only if udp is in protocols)
rtpPort: 8000
# port of the UDP RTCP listener
# port of the UDP RTCP listener (used only if udp is in protocols)
rtcpPort: 8001
# timeout of read operations
@ -13,8 +13,7 @@ readTimeout: 10s @@ -13,8 +13,7 @@ readTimeout: 10s
# timeout of write operations
writeTimeout: 5s
# supported authentication methods
# WARNING: both methods are insecure, use RTSP inside a VPN to enforce security.
# supported authentication methods (both are insecure, use RTSP inside a VPN to enforce security)
authMethods: [basic, digest]
# command to run when a client connects.

Loading…
Cancel
Save