revid: temp writeCloser wc in setupPipeline renamed to w

This commit is contained in:
Saxon 2019-04-10 12:22:41 +09:30
parent eb866ada5e
commit 850b45d791
1 changed files with 11 additions and 11 deletions

View File

@ -195,30 +195,30 @@ func (r *Revid) setupPipeline(mtsEnc, flvEnc func(dst io.Writer, rate int) (io.W
// We will go through our outputs and create the corresponding senders to add
// to mtsSenders if the output requires MPEGTS encoding, or flvSenders if the
// output requires FLV encoding.
var wc io.WriteCloser
var w io.WriteCloser
for _, out := range r.config.Outputs {
switch out {
case Http:
wc = newMtsSender(newHttpSender(r.ns, r.config.Logger.Log), r.config.Logger.Log, ringBufferSize, ringBufferElementSize, writeTimeout)
mtsSenders = append(mtsSenders, wc)
w = newMtsSender(newHttpSender(r.ns, r.config.Logger.Log), r.config.Logger.Log, ringBufferSize, ringBufferElementSize, writeTimeout)
mtsSenders = append(mtsSenders, w)
case Rtp:
wc, err := newRtpSender(r.config.RtpAddress, r.config.Logger.Log, r.config.FrameRate)
w, 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())
}
mtsSenders = append(mtsSenders, wc)
mtsSenders = append(mtsSenders, w)
case File:
wc, err := newFileSender(r.config.OutputPath)
w, err := newFileSender(r.config.OutputPath)
if err != nil {
return err
}
mtsSenders = append(mtsSenders, wc)
mtsSenders = append(mtsSenders, w)
case Rtmp:
wc, err := newRtmpSender(r.config.RtmpUrl, rtmpConnectionTimeout, rtmpConnectionMaxTries, r.config.Logger.Log)
w, 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, wc)
flvSenders = append(flvSenders, w)
}
}
@ -343,8 +343,8 @@ func (r *Revid) Stop() {
return
}
for _, wc := range r.writeClosers {
err := wc.Close()
for _, w := range r.writeClosers {
err := w.Close()
if err != nil {
r.config.Logger.Log(logger.Error, pkg+"could not close all writeClosers, cannot stop", "error", err.Error())
return