revid: defaulting to sendRetry on for Rtmp output

This commit is contained in:
Saxon 2019-03-03 16:38:03 +10:30
parent b5954d3f53
commit b92466bab8
2 changed files with 7 additions and 9 deletions

View File

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

View File

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