diff --git a/revid/config.go b/revid/config.go index c82573ec..0e0fd957 100644 --- a/revid/config.go +++ b/revid/config.go @@ -171,7 +171,6 @@ func (c *Config) Validate(r *Revid) error { } switch c.Output { - case Http: case File: case NativeRtmp, FfmpegRtmp: if c.RtmpUrl == "" { @@ -184,6 +183,10 @@ func (c *Config) Validate(r *Revid) error { case NothingDefined: r.Log(Warning, "No output defined, defaulting to httpOut!") c.Output = defaultOutput + fallthrough + case Http: + r.Log(Info, "Defaulting frames per clip to 7 for http output!") + c.FramesPerClip = "7" default: return errors.New("Bad output type defined in config!") } diff --git a/revid/revid.go b/revid/revid.go index 26b42324..9662df39 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -328,19 +328,23 @@ func (r *Revid) packClips() { } packetCount++ clipSize += lenOfFrame - fpcAsInt, err := strconv.Atoi(r.config.FramesPerClip) + // FIXME(kortschak): This should be happening only + // once per config modification, so move it there + // and change Config.FramesPerClip to int. + fpc, err := strconv.Atoi(r.config.FramesPerClip) if err != nil { r.Log(Error, "Frames per clip not quite right! Defaulting to 1!") r.config.FramesPerClip = "1" + fpc = 1 } - if packetCount >= fpcAsInt { + if packetCount >= fpc { r.ringBuffer.Flush() clipSize = 0 packetCount = 0 continue } default: - time.Sleep(time.Duration(5) * time.Millisecond) + time.Sleep(5 * time.Millisecond) } } }