diff --git a/revid/config/config.go b/revid/config/config.go index afa0862e..88228867 100644 --- a/revid/config/config.go +++ b/revid/config/config.go @@ -71,7 +71,6 @@ const ( // General revid defaults. defaultInput = InputRaspivid defaultOutput = OutputHTTP - defaultWriteRate = 25 defaultTimeout = 0 defaultInputCodec = codecutil.H264 defaultVerbosity = logger.Error @@ -80,6 +79,7 @@ const ( defaultBurstPeriod = 10 // Seconds defaultMinFrames = 100 defaultFrameRate = 25 + defaultWriteRate = 25 defaultClipDuration = 0 defaultAudioInputCodec = codecutil.ADPCM @@ -335,11 +335,14 @@ 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) + if c.FrameRate <= 0 { + c.Logger.Log(logger.Info, pkg+"frame rate bad or unset, defaulting", "FrameRate", defaultFrameRate) c.FrameRate = defaultFrameRate - } else if c.FrameRate < 0 { - return errors.New("frame rate less than 0") + } + + if c.WriteRate <= 0 { + c.Logger.Log(logger.Info, pkg+"write rate bad or unset, defaulting", "writeRate", defaultWriteRate) + c.WriteRate = defaultWriteRate } if c.ClipDuration == 0 {