revid/config/config.go: checking WriteRate as we need that for encoders

This commit is contained in:
Saxon 2019-11-13 13:58:53 +10:30
parent cf130de752
commit 527472e934
1 changed files with 8 additions and 5 deletions

View File

@ -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 {