flushing data in different spot

This commit is contained in:
Saxon1 2018-05-06 01:15:51 +09:30
parent c7ec750b4f
commit d2ff9731e4
1 changed files with 3 additions and 3 deletions

View File

@ -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()
}
}