From d2ff9731e47158dc43bc3b9c53f5644873f35656 Mon Sep 17 00:00:00 2001 From: Saxon1 Date: Sun, 6 May 2018 01:15:51 +0930 Subject: [PATCH] flushing data in different spot --- revid/Revid.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/revid/Revid.go b/revid/Revid.go index 07654eed..ff6ad8c9 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -60,7 +60,7 @@ const ( clipDuration = 1 // s mp2tPacketSize = 188 // MPEG-TS packet size mp2tMaxPackets = 2016 * clipDuration // # first multiple of 7 and 8 greater than 2000 - ringBufferSize = 1000 + ringBufferSize = 500 ringBufferElementSize = 150000 httpTimeOut = 5 // s packetsPerFrame = 7 @@ -68,7 +68,7 @@ const ( mjpegParserInChanLen = 100000 ffmpegPath = "/usr/local/bin/ffmpeg" rtmpConnectionTimout = 10 - outputChanSize = 10000 + outputChanSize = 1000 cameraRetryPeriod = 5 * time.Second sendFailedDelay = 5 maxSendFailedErrorCount = 500 @@ -325,7 +325,6 @@ func (r *revid) packClips() { // Keep clearing output chan until out buffer has some space //r.rtmpInst.EndSession() for clip, err = r.ringBuffer.Get(); err != nil; { - r.flushData() clip, err = r.ringBuffer.Get() } r.Log(Debug, "Finally got mem from ringbuffer!") @@ -403,6 +402,7 @@ func (r *revid) outputClips() { r.Log(Error, err2.Error()) if r.config.Output == NativeRtmp { r.rtmpInst.EndSession() + r.flushData() err = r.rtmpInst.StartSession() } }