updating remote

This commit is contained in:
saxon.milton@gmail.com 2018-03-13 21:19:24 +10:30
parent 4d152494c5
commit d762352a97
1 changed files with 10 additions and 8 deletions

View File

@ -59,9 +59,9 @@ const (
clipDuration = 1 // s
mp2tPacketSize = 188 // MPEG-TS packet size
mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000
ringBufferSize = 100 / clipDuration
ringBufferElementSize = 100000
maxClipSize = 100000
ringBufferSize = 10000
ringBufferElementSize = 10000
maxClipSize = 10000
httpTimeOut = 5 // s
packetsPerFrame = 7
h264BufferSize = 1000000
@ -311,19 +311,21 @@ func (r *revidInst) outputClips() {
now := time.Now()
prevTime := now
bytes := 0
delay := 0
//delay := 15
for r.isRunning {
// Here we slow things down as much as we can to decrease cpu usage
/*
switch {
case r.ringBuffer.GetNoOfElements() < 2:
case r.ringBuffer.GetNoOfElements() < 100:
delay++
time.Sleep(time.Duration(delay) * time.Millisecond)
case delay > 10:
delay-=10
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))
//r.Log(Debug, fmt.Sprintf("Delay is: %v\n", delay))
r.Log(Debug, fmt.Sprintf("Ring buffer size: %v\n", r.ringBuffer.GetNoOfElements()))
// Output clip to the output specified in the configuration struct
bytes += len(clip)