revid: added handling of burstPeriod to config

This commit is contained in:
saxon 2019-02-03 23:43:51 +10:30
parent 1010721dd0
commit 6171c4e999
2 changed files with 14 additions and 0 deletions

View File

@ -68,6 +68,7 @@ type Config struct {
RtpAddress string
Logger Logger
SendRetry bool
BurstPeriod uint
}
// Enums for config struct
@ -114,6 +115,7 @@ const (
defaultInputCodec = H264
defaultVerbosity = No // FIXME(kortschak): This makes no sense whatsoever. No is currently 15.
defaultRtpAddr = "localhost:6970"
defaultBurstPeriod = 10 // Seconds
)
// Validate checks for any errors in the config fields and defaults settings
@ -200,6 +202,11 @@ func (c *Config) Validate(r *Revid) error {
}
}
if c.BurstPeriod == 0 {
c.Logger.Log(logger.Warning, pkg+"no burst period defined, defaulting", "burstPeriod", defaultBurstPeriod)
c.BurstPeriod = defaultBurstPeriod
}
if c.FramesPerClip < 1 {
c.Logger.Log(logger.Warning, pkg+"no FramesPerClip defined, defaulting",
"framesPerClip", defaultFramesPerClip)

View File

@ -477,6 +477,13 @@ func (r *Revid) Update(vars map[string]string) error {
default:
r.config.Logger.Log(logger.Warning, pkg+"invalid VerticalFlip param", "value", value)
}
case "BurstPeriod":
v, err := strconv.ParseUint(value, 10, 0)
if err != nil {
r.config.Logger.Log(logger.Warning, pkg+"invalid BurstPeriod param", "value", value)
break
}
r.config.BurstPeriod = uint(v)
default:
}
}