further fixed error handling

This commit is contained in:
Saxon1 2018-04-19 19:33:37 +09:30
parent 920755376e
commit ee6cecd908
1 changed files with 4 additions and 6 deletions

View File

@ -351,17 +351,17 @@ func (r *revid) outputClips() {
}
// If the ringbuffer has something we can read and send off
if clip, err1 := r.ringBuffer.Read(); err1 == nil {
if clip, err := r.ringBuffer.Read(); err == nil {
bytes += len(clip)
errorCount := 0
for err2 := r.sendClip(clip); err != nil; errorCount++ {
for err := r.sendClip(clip); err != nil; errorCount++ {
if len(clip) >= 11 {
r.Log(Warning, "Send failed trying again!")
err2 = r.sendClip(clip)
err = r.sendClip(clip)
} else {
break
}
r.Log(Error, err2.Error())
r.Log(Error, err.Error())
if r.config.Output == NativeRtmp && errorCount > 5 {
reboot()
}
@ -380,8 +380,6 @@ func (r *revid) outputClips() {
prevTime = now
bytes = 0
}
} else {
r.Log(Debug, err.Error())
}
}
r.Log(Info, "Not outputting clips anymore!")