mirror of
https://github.com/aler9/rtsp-simple-server
synced 2025-11-01 03:22:50 +08:00
add tests
This commit is contained in:
25
main.go
25
main.go
@@ -65,23 +65,24 @@ type program struct {
|
||||
}
|
||||
|
||||
func newProgram(args args) (*program, error) {
|
||||
if args.protocolsStr == "" {
|
||||
args.protocolsStr = "udp,tcp"
|
||||
}
|
||||
if args.rtspPort == 0 {
|
||||
args.rtspPort = 8554
|
||||
}
|
||||
if args.rtpPort == 0 {
|
||||
args.rtpPort = 8000
|
||||
}
|
||||
if args.rtcpPort == 0 {
|
||||
args.rtcpPort = 8001
|
||||
}
|
||||
|
||||
if args.version == true {
|
||||
fmt.Println("rtsp-simple-server " + Version)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if args.rtspPort == 0 {
|
||||
return nil, fmt.Errorf("rtsp port not provided")
|
||||
}
|
||||
|
||||
if args.rtpPort == 0 {
|
||||
return nil, fmt.Errorf("rtp port not provided")
|
||||
}
|
||||
|
||||
if args.rtcpPort == 0 {
|
||||
return nil, fmt.Errorf("rtcp port not provided")
|
||||
}
|
||||
|
||||
if (args.rtpPort % 2) != 0 {
|
||||
return nil, fmt.Errorf("rtp port must be even")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user