From f7b3acb4d681f9548667736721f79bfc06e4c1d6 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 13 Mar 2018 21:27:34 +1030 Subject: [PATCH] This has got to work --- revid/RevidInstance.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/revid/RevidInstance.go b/revid/RevidInstance.go index 396e0241..727ddfca 100644 --- a/revid/RevidInstance.go +++ b/revid/RevidInstance.go @@ -311,18 +311,17 @@ func (r *revidInst) outputClips() { now := time.Now() prevTime := now bytes := 0 - //delay := 15 + delay := 40 for r.isRunning { // Here we slow things down as much as we can to decrease cpu usage - /* switch { - case r.ringBuffer.GetNoOfElements() < 100: + case r.ringBuffer.GetNoOfElements() < 5000: delay++ time.Sleep(time.Duration(delay) * time.Millisecond) case delay > 0: delay-- } - */ + // If the ringbuffer has something we can read and send off if clip, err := r.ringBuffer.Read(); err == nil { //r.Log(Debug, fmt.Sprintf("Delay is: %v\n", delay)) @@ -452,8 +451,8 @@ func (r *revidInst) setupOutputForFile() (err error) { // setupInputForRaspivid sets up things for input from raspivid i.e. starts // a raspivid process and pipes it's data output. func (r *revidInst) setupInputForRaspivid() error { - fps,_ := strconv.Atoi(r.config.FrameRate) - r.parser.SetDelay( uint( float64(1000) / float64(fps) ) ) + //fps,_ := strconv.Atoi(r.config.FrameRate) + //r.parser.SetDelay( uint( float64(1000) / float64(fps) ) ) r.Log(Info, "Starting raspivid!") switch r.config.InputCodec { case H264: