Let's try this

This commit is contained in:
Saxon1 2018-04-26 16:17:09 +09:30
parent 5847aad552
commit c29d4097e2
1 changed files with 5 additions and 10 deletions

View File

@ -312,16 +312,9 @@ func (r *revid) packClips() {
r.Log(Error, err.Error()) r.Log(Error, err.Error())
r.Log(Warning, "Clearing output chan!") r.Log(Warning, "Clearing output chan!")
// Keep clearing output chan until out buffer has some space // Keep clearing output chan until out buffer has some space
r.rtmpInst.EndSession()
for clip, err = r.ringBuffer.Get(); err != nil; { for clip, err = r.ringBuffer.Get(); err != nil; {
r.flushData() 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() clip, err = r.ringBuffer.Get()
} }
r.Log(Debug, "Finally got mem from ringbuffer!") r.Log(Debug, "Finally got mem from ringbuffer!")
@ -405,8 +398,10 @@ func (r *revid) outputClips() {
time.Sleep(time.Duration(sendFailedDelay) * time.Second) time.Sleep(time.Duration(sendFailedDelay) * time.Second)
} }
r.Log(Error, err2.Error()) r.Log(Error, err2.Error())
if r.config.Output == NativeRtmp && errorCount > 5 { if r.config.Output == NativeRtmp && errorCount > 10 {
r.reboot() 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 // let the ringbuffer know that we're done with the memory we grabbed when