revid/config/config.go: need to check frame rate here too as revid needs it

This commit is contained in:
Saxon 2019-11-13 13:38:33 +10:30
parent 274f33e5b2
commit cf130de752
1 changed files with 8 additions and 0 deletions

View File

@ -79,6 +79,7 @@ const (
defaultCameraIP = "192.168.1.50"
defaultBurstPeriod = 10 // Seconds
defaultMinFrames = 100
defaultFrameRate = 25
defaultClipDuration = 0
defaultAudioInputCodec = codecutil.ADPCM
@ -334,6 +335,13 @@ func (c *Config) Validate() error {
return errors.New("refresh period is less than 0")
}
if c.FrameRate == 0 {
c.Logger.Log(logger.Info, pkg+"no frame rate defined, defaulting", "FrameRate", defaultFrameRate)
c.FrameRate = defaultFrameRate
} else if c.FrameRate < 0 {
return errors.New("frame rate less than 0")
}
if c.ClipDuration == 0 {
c.Logger.Log(logger.Info, pkg+"no clip duration defined, defaulting", "ClipDuration", defaultClipDuration)
c.ClipDuration = defaultClipDuration