From 527472e93410aaa505f2c7288b47dcaaa60dfcb6 Mon Sep 17 00:00:00 2001 From: Saxon Date: Wed, 13 Nov 2019 13:58:53 +1030 Subject: [PATCH] revid/config/config.go: checking WriteRate as we need that for encoders --- revid/config/config.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 {