mirror of https://bitbucket.org/ausocean/av.git
Merged in zombie-routine-fix (pull request #251)
revid: setup pipeline when revid.Start() is called, not on call to revid.New() Approved-by: Alan Noble <anoble@gmail.com>
This commit is contained in:
commit
8adcd94f33
|
@ -119,10 +119,11 @@ 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)
|
||||
err := r.setConfig(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("could not set config, failed with error: %v",err)
|
||||
}
|
||||
r.config.Logger.SetLevel(c.LogLevel)
|
||||
go r.handleErrors()
|
||||
return &r, nil
|
||||
}
|
||||
|
@ -317,13 +318,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 +549,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
|
||||
|
|
Loading…
Reference in New Issue