From b7ef1a1a2ba765dcc5f19491758f19309e7b894c Mon Sep 17 00:00:00 2001 From: Saxon Date: Thu, 14 Mar 2019 13:44:33 +1030 Subject: [PATCH] revid: improved error handling in revid.reset encoder/sender setup logic --- revid/revid.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 0f21044f..8c5b4781 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -195,16 +195,22 @@ func (r *Revid) reset(config Config) error { sender = newMtsSender(newMinimalHttpSender(r.ns, r.config.Logger.Log), nil) case Rtp: sender, err = newRtpSender(r.config.RtpAddress, r.config.Logger.Log, r.config.FrameRate) + if err != nil { + r.config.Logger.Log(logger.Warning, pkg+"rtp connect error", "error", err.Error()) + } case File: sender, err = newFileSender(r.config.OutputPath) + if err != nil { + return err + } case Rtmp: - sender, _ = newRtmpSender(r.config.RtmpUrl, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log) + sender, err = newRtmpSender(r.config.RtmpUrl, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log) + if err != nil { + r.config.Logger.Log(logger.Warning, pkg+"rtmp connect error", "error", err.Error()) + } flvSenders = append(flvSenders, sender) continue } - if err != nil { - return err - } mtsSenders = append(mtsSenders, sender) }