diff --git a/revid/Revid.go b/revid/Revid.go index 91110324..4a8f0b57 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -374,13 +374,16 @@ func (r *revid) outputClips() { if clip, err := r.ringBuffer.Read(); err == nil { bytes += len(clip) errorCount := 0 - err := r.sendClip(clip) - for ; err != nil; errorCount++ { + err2 := r.sendClip(clip) + for ; err2 != nil; errorCount++ { r.Log(Warning, "Send failed trying again!") // If the clip size is not bigger than the threshold then we classify // it as junk and we don't try to send it off again. if len(clip) >= clipSizeThreshold { - err = r.sendClip(clip) + err2 = r.sendClip(clip) + if err2 == nil { + break + } } else { break } @@ -389,7 +392,7 @@ func (r *revid) outputClips() { if errorCount > maxSendFailedErrorCount { time.Sleep(time.Duration(sendFailedDelay) * time.Second) } - r.Log(Error, err.Error()) + r.Log(Error, err2.Error()) if r.config.Output == NativeRtmp && errorCount > 5 { r.reboot() }