mirror of https://bitbucket.org/ausocean/av.git
device/alsa,revid: clarify type conditions and remove redundant condition
This commit is contained in:
parent
60bfa3df4e
commit
95991f4c75
|
@ -56,9 +56,12 @@ func TestDevice(t *testing.T) {
|
||||||
err := ai.Setup(c)
|
err := ai.Setup(c)
|
||||||
// Log any config errors, otherwise if there was an error opening a device, skip
|
// Log any config errors, otherwise if there was an error opening a device, skip
|
||||||
// this test since not all testing environments will have recording devices.
|
// this test since not all testing environments will have recording devices.
|
||||||
if _, ok := err.(device.MultiError); err != nil && ok {
|
switch err := err.(type) {
|
||||||
|
case nil:
|
||||||
|
// Do nothing.
|
||||||
|
case device.MultiError:
|
||||||
t.Logf("errors from configuring device: %s", err.Error())
|
t.Logf("errors from configuring device: %s", err.Error())
|
||||||
} else if err != nil {
|
default:
|
||||||
t.Skip(err)
|
t.Skip(err)
|
||||||
}
|
}
|
||||||
err = ai.Start()
|
err = ai.Start()
|
||||||
|
|
|
@ -53,9 +53,12 @@ func (r *Revid) setupAudio() error {
|
||||||
// Configure ALSA device.
|
// Configure ALSA device.
|
||||||
r.cfg.Logger.Log(logger.Debug, "configuring input device")
|
r.cfg.Logger.Log(logger.Debug, "configuring input device")
|
||||||
err := d.Setup(r.cfg)
|
err := d.Setup(r.cfg)
|
||||||
if _, ok := err.(device.MultiError); err != nil && ok {
|
switch err := err.(type) {
|
||||||
|
case nil:
|
||||||
|
// Do nothing.
|
||||||
|
case device.MultiError:
|
||||||
r.cfg.Logger.Log(logger.Warning, "errors from configuring input device", "errors", err)
|
r.cfg.Logger.Log(logger.Warning, "errors from configuring input device", "errors", err)
|
||||||
} else if err != nil {
|
default:
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
r.cfg.Logger.Log(logger.Info, "input device configured")
|
r.cfg.Logger.Log(logger.Info, "input device configured")
|
||||||
|
|
Loading…
Reference in New Issue