This has got to work

This commit is contained in:
Unknown 2018-03-13 21:27:34 +10:30
parent 2dccba6969
commit f7b3acb4d6
1 changed files with 5 additions and 6 deletions

View File

@ -311,18 +311,17 @@ func (r *revidInst) outputClips() {
now := time.Now() now := time.Now()
prevTime := now prevTime := now
bytes := 0 bytes := 0
//delay := 15 delay := 40
for r.isRunning { for r.isRunning {
// Here we slow things down as much as we can to decrease cpu usage // Here we slow things down as much as we can to decrease cpu usage
/*
switch { switch {
case r.ringBuffer.GetNoOfElements() < 100: case r.ringBuffer.GetNoOfElements() < 5000:
delay++ delay++
time.Sleep(time.Duration(delay) * time.Millisecond) time.Sleep(time.Duration(delay) * time.Millisecond)
case delay > 0: case delay > 0:
delay-- delay--
} }
*/
// If the ringbuffer has something we can read and send off // If the ringbuffer has something we can read and send off
if clip, err := r.ringBuffer.Read(); err == nil { if clip, err := r.ringBuffer.Read(); err == nil {
//r.Log(Debug, fmt.Sprintf("Delay is: %v\n", delay)) //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 // setupInputForRaspivid sets up things for input from raspivid i.e. starts
// a raspivid process and pipes it's data output. // a raspivid process and pipes it's data output.
func (r *revidInst) setupInputForRaspivid() error { func (r *revidInst) setupInputForRaspivid() error {
fps,_ := strconv.Atoi(r.config.FrameRate) //fps,_ := strconv.Atoi(r.config.FrameRate)
r.parser.SetDelay( uint( float64(1000) / float64(fps) ) ) //r.parser.SetDelay( uint( float64(1000) / float64(fps) ) )
r.Log(Info, "Starting raspivid!") r.Log(Info, "Starting raspivid!")
switch r.config.InputCodec { switch r.config.InputCodec {
case H264: case H264: