diff --git a/revid/Revid.go b/revid/Revid.go index e72388b8..6d35f48c 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -312,16 +312,9 @@ func (r *revid) packClips() { r.Log(Error, err.Error()) r.Log(Warning, "Clearing output chan!") // Keep clearing output chan until out buffer has some space + r.rtmpInst.EndSession() for clip, err = r.ringBuffer.Get(); err != nil; { r.flushData() - r.Log(Debug,"Ending rtmp session") - r.rtmpInst.EndSession() - r.Log(Debug, "Creating new session") - r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout) - rtmpError := r.rtmpInst.StartSession() - if rtmpError != nil { - r.Log(Error, rtmpError.Error()) - } clip, err = r.ringBuffer.Get() } r.Log(Debug, "Finally got mem from ringbuffer!") @@ -405,8 +398,10 @@ func (r *revid) outputClips() { time.Sleep(time.Duration(sendFailedDelay) * time.Second) } r.Log(Error, err2.Error()) - if r.config.Output == NativeRtmp && errorCount > 5 { - r.reboot() + if r.config.Output == NativeRtmp && errorCount > 10 { + r.rtmpInst.EndSession() + r.rtmpInst = rtmp.NewRTMPSession(r.config.RtmpUrl, rtmpConnectionTimout) + err = r.rtmpInst.StartSession() } } // let the ringbuffer know that we're done with the memory we grabbed when