mirror of https://bitbucket.org/ausocean/av.git
device: fix incorrect uses of MultiError and guard against misuse
This commit is contained in:
parent
e3c5d01a97
commit
60bfa3df4e
|
@ -177,7 +177,7 @@ func (d *ALSA) Setup(c config.Config) error {
|
|||
d.mode = paused
|
||||
go d.input()
|
||||
|
||||
if errs != nil {
|
||||
if len(errs) != 0 {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -68,5 +68,8 @@ type AVDevice interface {
|
|||
type MultiError []error
|
||||
|
||||
func (me MultiError) Error() string {
|
||||
if len(me) == 0 {
|
||||
panic("device: invalid use of MultiError")
|
||||
}
|
||||
return fmt.Sprintf("%v", []error(me))
|
||||
}
|
||||
|
|
|
@ -203,7 +203,10 @@ func (g *GeoVision) Set(c avconfig.Config) error {
|
|||
const setupDelay = 5 * time.Second
|
||||
time.Sleep(setupDelay)
|
||||
|
||||
return errs
|
||||
if len(errs) != 0 {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start uses an RTSP client to communicate with the GeoVision RTSP server and
|
||||
|
|
|
@ -135,5 +135,8 @@ func (r *Raspistill) Set(c config.Config) error {
|
|||
}
|
||||
|
||||
r.cfg = c
|
||||
return errs
|
||||
if len(errs) != 0 {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -239,7 +239,10 @@ func (r *Raspivid) Set(c config.Config) error {
|
|||
}
|
||||
|
||||
r.cfg = c
|
||||
return errs
|
||||
if len(errs) != 0 {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func goodAWBGains(g string) bool {
|
||||
|
|
|
@ -115,7 +115,10 @@ func (w *Webcam) Set(c config.Config) error {
|
|||
c.Bitrate = defaultBitrate
|
||||
}
|
||||
w.cfg = c
|
||||
return errs
|
||||
if len(errs) != 0 {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Start will build the required arguments for ffmpeg and then execute the
|
||||
|
|
Loading…
Reference in New Issue