From b92466bab8117ee4f5133103e0becb08d840e888 Mon Sep 17 00:00:00 2001 From: Saxon Date: Sun, 3 Mar 2019 16:38:03 +1030 Subject: [PATCH] revid: defaulting to sendRetry on for Rtmp output --- revid/config.go | 5 +++-- revid/revid.go | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/revid/config.go b/revid/config.go index 77226520..b3d91964 100644 --- a/revid/config.go +++ b/revid/config.go @@ -57,8 +57,8 @@ type Config struct { FramesPerClip uint RtmpUrl string Bitrate uint - OutputPath string - InputPath string + OutputPath string + InputPath string Height uint Width uint FrameRate uint @@ -187,6 +187,7 @@ func (c *Config) Validate(r *Revid) error { "framesPerClip", defaultFramesPerClip) c.FramesPerClip = defaultFramesPerClip c.Packetization = Flv + c.SendRetry = true case NothingDefined: c.Logger.Log(logger.Warning, pkg+"no output defined, defaulting", "output", defaultOutput) diff --git a/revid/revid.go b/revid/revid.go index 22f094ee..74f591d3 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -540,7 +540,7 @@ loop: err = dest.send() if err == nil { r.config.Logger.Log(logger.Debug, pkg+"sent clip to output "+strconv.Itoa(i)) - } else if r.config.SendRetry == false { + } else if !r.config.SendRetry { r.config.Logger.Log(logger.Warning, pkg+"send to output "+strconv.Itoa(i)+" failed", "error", err.Error()) } else { r.config.Logger.Log(logger.Error, pkg+"send to output "+strconv.Itoa(i)+ @@ -549,19 +549,16 @@ loop: if err != nil && chunk.Len() > 11 { r.config.Logger.Log(logger.Error, pkg+"second send attempted failed, restarting connection", "error", err.Error()) for err != nil { - time.Sleep(sendFailedDelay) if rs, ok := dest.(restarter); ok { r.config.Logger.Log(logger.Debug, pkg+"restarting session", "session", rs) err = rs.restart() if err != nil { r.config.Logger.Log(logger.Error, pkg+"failed to restart rtmp session", "error", err.Error()) - r.setIsRunning(false) - return + time.Sleep(sendFailedDelay) + continue } - - r.config.Logger.Log(logger.Info, pkg+"restarted rtmp session") } - + r.config.Logger.Log(logger.Info, pkg+"restarted rtmp session, sending again") err = dest.send() if err != nil { r.config.Logger.Log(logger.Error, pkg+"send failed again, with error", "error", err.Error())