Browse Source

forbid using 'rpiCamera' as source on regexp paths

pull/1198/head
aler9 3 years ago
parent
commit
ec4ec142b4
  1. 11
      internal/conf/path.go
  2. 2
      rtsp-simple-server.yml

11
internal/conf/path.go

@ -110,7 +110,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error { @@ -110,7 +110,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "rtsp://") ||
strings.HasPrefix(pconf.Source, "rtsps://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTSP source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTSP source. use another path")
}
_, err := url.Parse(pconf.Source)
@ -121,7 +121,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error { @@ -121,7 +121,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "rtmp://") ||
strings.HasPrefix(pconf.Source, "rtmps://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTMP source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a RTMP source. use another path")
}
u, err := gourl.Parse(pconf.Source)
@ -141,7 +141,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error { @@ -141,7 +141,7 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
case strings.HasPrefix(pconf.Source, "http://") ||
strings.HasPrefix(pconf.Source, "https://"):
if pconf.Regexp != nil {
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a HLS source; use another path")
return fmt.Errorf("a path with a regular expression (or path 'all') cannot have a HLS source. use another path")
}
u, err := gourl.Parse(pconf.Source)
@ -172,6 +172,11 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error { @@ -172,6 +172,11 @@ func (pconf *PathConf) checkAndFillMissing(conf *Conf, name string) error {
}
case pconf.Source == "rpiCamera":
if pconf.Regexp != nil {
return fmt.Errorf(
"a path with a regular expression (or path 'all') cannot have 'rpiCamera' as source. use another path")
}
if pconf.RPICameraWidth == 0 {
pconf.RPICameraWidth = 1280
}

2
rtsp-simple-server.yml

@ -14,7 +14,7 @@ readTimeout: 10s @@ -14,7 +14,7 @@ readTimeout: 10s
# Timeout of write operations.
writeTimeout: 10s
# Number of read buffers.
# A higher number allows a wider throughput, a lower number allows to save RAM.
# A higher value allows a wider throughput, a lower value allows to save RAM.
readBufferCount: 512
# HTTP URL to perform external authentication.

Loading…
Cancel
Save