revid: not setting up pipeline until we start

This commit is contained in:
Saxon 2019-09-12 17:08:22 +09:30
parent 0fd56675d5
commit 9769a3c4a9
1 changed files with 8 additions and 7 deletions

View File

@ -119,10 +119,6 @@ type Revid struct {
// an error if construction of the new instance was not successful.
func New(c Config, ns *netsender.Sender) (*Revid, error) {
r := Revid{ns: ns, err: make(chan error)}
err := r.reset(c)
if err != nil {
return nil, err
}
go r.handleErrors()
return &r, nil
}
@ -317,13 +313,18 @@ func (r *Revid) Start() error {
}
r.config.Logger.Log(logger.Info, pkg+"starting Revid")
r.isRunning = true
var err error
err := r.reset(r.config)
if err != nil {
r.Stop()
return err
}
r.closeInput, err = r.setupInput()
if err != nil {
r.Stop()
}
return err
}
return nil
}
// Stop closes down the pipeline. This closes encoders and sender output routines,
// connections, and/or files.
@ -543,7 +544,7 @@ func (r *Revid) Update(vars map[string]string) error {
}
}
r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config))
return r.reset(r.config)
return nil
}
// startRaspivid sets up things for input from raspivid i.e. starts