revid: change default frames/clip to 7 for http

This increases effective bitrate to 88kpbs from 12kbps with fpc=1.
This commit is contained in:
Dan Kortschak 2018-06-20 12:48:08 +09:30
parent 89e5178fde
commit 090ad746a6
2 changed files with 11 additions and 4 deletions

View File

@ -171,7 +171,6 @@ func (c *Config) Validate(r *Revid) error {
} }
switch c.Output { switch c.Output {
case Http:
case File: case File:
case NativeRtmp, FfmpegRtmp: case NativeRtmp, FfmpegRtmp:
if c.RtmpUrl == "" { if c.RtmpUrl == "" {
@ -184,6 +183,10 @@ func (c *Config) Validate(r *Revid) error {
case NothingDefined: case NothingDefined:
r.Log(Warning, "No output defined, defaulting to httpOut!") r.Log(Warning, "No output defined, defaulting to httpOut!")
c.Output = defaultOutput c.Output = defaultOutput
fallthrough
case Http:
r.Log(Info, "Defaulting frames per clip to 7 for http output!")
c.FramesPerClip = "7"
default: default:
return errors.New("Bad output type defined in config!") return errors.New("Bad output type defined in config!")
} }

View File

@ -328,19 +328,23 @@ func (r *Revid) packClips() {
} }
packetCount++ packetCount++
clipSize += lenOfFrame 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 { if err != nil {
r.Log(Error, "Frames per clip not quite right! Defaulting to 1!") r.Log(Error, "Frames per clip not quite right! Defaulting to 1!")
r.config.FramesPerClip = "1" r.config.FramesPerClip = "1"
fpc = 1
} }
if packetCount >= fpcAsInt { if packetCount >= fpc {
r.ringBuffer.Flush() r.ringBuffer.Flush()
clipSize = 0 clipSize = 0
packetCount = 0 packetCount = 0
continue continue
} }
default: default:
time.Sleep(time.Duration(5) * time.Millisecond) time.Sleep(5 * time.Millisecond)
} }
} }
} }