mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-11-03 01:43:48 +08:00
initialize udp listeners only if udp is enabled
This commit is contained in:
5
main.go
5
main.go
@@ -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) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
for name, confp := range conf.Paths {
|
||||
if confp.RunOnInit != "" {
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
# 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.
|
||||
|
||||
Reference in New Issue
Block a user