mirror of https://bitbucket.org/ausocean/av.git
revid/config.go: define max value for MinFrames
This commit is contained in:
parent
ec0e19aec3
commit
b49e722c0b
|
@ -327,11 +327,15 @@ func (c *Config) Validate() error {
|
||||||
c.BurstPeriod = defaultBurstPeriod
|
c.BurstPeriod = defaultBurstPeriod
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.MinFrames == 0 {
|
const maxMinFrames = 1000
|
||||||
|
switch {
|
||||||
|
case c.MinFrames == 0:
|
||||||
c.Logger.Log(logger.Info, pkg+"no min period defined, defaulting", "MinFrames", defaultMinFrames)
|
c.Logger.Log(logger.Info, pkg+"no min period defined, defaulting", "MinFrames", defaultMinFrames)
|
||||||
c.MinFrames = defaultMinFrames
|
c.MinFrames = defaultMinFrames
|
||||||
} else if c.MinFrames < 0 {
|
case c.MinFrames < 0:
|
||||||
return errors.New("refresh period is less than 0")
|
return errors.New("refresh period is less than 0")
|
||||||
|
case c.MinFrames > maxMinFrames:
|
||||||
|
return errors.New("refresh period is greater than 1000")
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.FrameRate <= 0 {
|
if c.FrameRate <= 0 {
|
||||||
|
|
Loading…
Reference in New Issue