revid: improved error handling in revid.reset encoder/sender setup logic

This commit is contained in:
Saxon 2019-03-14 13:44:33 +10:30
parent 89ba74004a
commit b7ef1a1a2b
1 changed files with 10 additions and 4 deletions

View File

@ -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)
}