mirror of https://bitbucket.org/ausocean/av.git
Merged master into looper-systemd
This commit is contained in:
commit
e56b6507f7
|
@ -3,7 +3,7 @@ jobs:
|
|||
build:
|
||||
docker:
|
||||
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
|
||||
- image: circleci/golang:1.13
|
||||
- image: circleci/golang:1.15.2
|
||||
environment:
|
||||
GO111MODULE: "on"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
DESCRIPTION
|
||||
tests.go contains JPEG/RTP packets use for testing in jpeg_test.go.
|
||||
These are from a known good source from which the expected MJPEG file
|
||||
found in testdata/expect.mjpeg is derived.
|
||||
found in testdata/expect.mjpeg is derived.
|
||||
|
||||
AUTHOR
|
||||
Saxon Nelson-Milton <saxon@ausocean.org>
|
||||
|
|
|
@ -127,12 +127,12 @@ func TestIsRunning(t *testing.T) {
|
|||
InputCodec: codecutil.ADPCM,
|
||||
})
|
||||
if err != nil {
|
||||
t.Skipf("could not set device: %w", err)
|
||||
t.Skipf("could not set device: %v", err)
|
||||
}
|
||||
|
||||
err = d.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start device %w", err)
|
||||
t.Fatalf("could not start device %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(dur)
|
||||
|
|
|
@ -41,12 +41,12 @@ func TestIsRunning(t *testing.T) {
|
|||
InputPath: path,
|
||||
})
|
||||
if err != nil {
|
||||
t.Skipf("could not set device: %w", err)
|
||||
t.Skipf("could not set device: %v", err)
|
||||
}
|
||||
|
||||
err = d.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start device %w", err)
|
||||
t.Fatalf("could not start device %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(dur)
|
||||
|
|
|
@ -153,13 +153,13 @@ func TestCodecOut(t *testing.T) {
|
|||
},
|
||||
{
|
||||
s: settings{ch: 1},
|
||||
c: Codec(500),
|
||||
c: Codec("500"),
|
||||
want: settings{ch: 1},
|
||||
err: true,
|
||||
},
|
||||
{
|
||||
s: settings{ch: 2},
|
||||
c: Codec(500),
|
||||
c: Codec("500"),
|
||||
want: settings{ch: 2},
|
||||
err: true,
|
||||
},
|
||||
|
|
|
@ -47,12 +47,12 @@ func TestIsRunning(t *testing.T) {
|
|||
CameraIP: ip,
|
||||
})
|
||||
if err != nil {
|
||||
t.Skipf("could not set device: %w", err)
|
||||
t.Skipf("could not set device: %v", err)
|
||||
}
|
||||
|
||||
err = d.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start device %w", err)
|
||||
t.Fatalf("could not start device %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(dur)
|
||||
|
|
|
@ -45,12 +45,12 @@ func TestIsRunning(t *testing.T) {
|
|||
InputCodec: codecutil.H264,
|
||||
})
|
||||
if err != nil {
|
||||
t.Skipf("could not set device: %w", err)
|
||||
t.Skipf("could not set device: %v", err)
|
||||
}
|
||||
|
||||
err = d.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start device %w", err)
|
||||
t.Fatalf("could not start device %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(dur)
|
||||
|
|
|
@ -45,12 +45,12 @@ func TestIsRunning(t *testing.T) {
|
|||
InputCodec: codecutil.H264,
|
||||
})
|
||||
if err != nil {
|
||||
t.Skipf("could not set device: %w", err)
|
||||
t.Skipf("could not set device: %v", err)
|
||||
}
|
||||
|
||||
err = d.Start()
|
||||
if err != nil {
|
||||
t.Fatalf("could not start device %w", err)
|
||||
t.Fatalf("could not start device %v", err)
|
||||
}
|
||||
|
||||
time.Sleep(dur)
|
||||
|
|
|
@ -129,16 +129,16 @@ func main() {
|
|||
case *configPtr != "": // Decode JSON file to map.
|
||||
err = json.Unmarshal([]byte(*configPtr), &cfg)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not decode JSON config: %w", err))
|
||||
panic(fmt.Sprintf("could not decode JSON config: %v", err))
|
||||
}
|
||||
case *configFilePtr != "": // Decode JSON string to map from command line flag.
|
||||
f, err := os.Open(*configFilePtr)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not open config file: %w", err))
|
||||
panic(fmt.Sprintf("could not open config file: %v", err))
|
||||
}
|
||||
err = json.NewDecoder(f).Decode(&cfg)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not decode JSON config: %w", err))
|
||||
panic(fmt.Sprintf("could not decode JSON config: %v", err))
|
||||
}
|
||||
default: // No config information has been provided; give empty map to force defaults.
|
||||
cfg = map[string]string{}
|
||||
|
@ -167,19 +167,19 @@ func main() {
|
|||
|
||||
rv, err := revid.New(config.Config{Logger: log}, ns)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not create revid: %w", err))
|
||||
panic(fmt.Sprintf("could not create revid: %v", err))
|
||||
}
|
||||
|
||||
// Configure revid with configuration map obtained through flags or file.
|
||||
// If config is empty, defaults will be adopted by revid.
|
||||
err = rv.Update(cfg)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not update revid config: %w", err))
|
||||
panic(fmt.Sprintf("could not update revid config: %v", err))
|
||||
}
|
||||
|
||||
err = rv.Start()
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not start revid: %w", err))
|
||||
panic(fmt.Sprintf("could not start revid: %v", err))
|
||||
}
|
||||
|
||||
// Run indefinitely.
|
||||
|
|
|
@ -81,8 +81,8 @@ type Object struct {
|
|||
// Number, string types use String and arrays and objects use
|
||||
// Object. The Name is optional.
|
||||
type Property struct {
|
||||
Type uint8
|
||||
|
||||
Type uint8
|
||||
|
||||
Name string
|
||||
Number float64
|
||||
String string
|
||||
|
|
|
@ -50,7 +50,7 @@ func NewClient(addr string) (c *Client, local, remote *net.TCPAddr, err error) {
|
|||
c = &Client{addr: addr}
|
||||
c.url, err = url.Parse(addr)
|
||||
if err != nil {
|
||||
return nil, nil,nil, err
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
c.conn, err = net.Dial("tcp", c.url.Host)
|
||||
if err != nil {
|
||||
|
|
|
@ -69,7 +69,7 @@ func (r *Revid) reset(c config.Config) error {
|
|||
r.cfg.Logger.Log(logger.Debug, "setting config")
|
||||
err := r.setConfig(c)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not set config: %w",err)
|
||||
return fmt.Errorf("could not set config: %w", err)
|
||||
}
|
||||
r.cfg.Logger.Log(logger.Info, "config set")
|
||||
|
||||
|
@ -95,7 +95,7 @@ func (r *Revid) reset(c config.Config) error {
|
|||
encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second))
|
||||
r.cfg.CBR = true
|
||||
case codecutil.PCM, codecutil.ADPCM:
|
||||
return nil, errors.New(fmt.Sprintf("invalid input codec: %v for input: %v",r.cfg.InputCodec,r.cfg.Input))
|
||||
return nil, errors.New(fmt.Sprintf("invalid input codec: %v for input: %v", r.cfg.InputCodec, r.cfg.Input))
|
||||
default:
|
||||
panic("unknown input codec")
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ func (r *Revid) reset(c config.Config) error {
|
|||
r.cfg.Logger.Log(logger.Info, "finished setting pipeline")
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not set up pipeline: %w",err)
|
||||
return fmt.Errorf("could not set up pipeline: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -282,7 +282,7 @@ func (r *Revid) setupPipeline(mtsEnc func(dst io.WriteCloser, rate float64) (io.
|
|||
err = r.setupAudio()
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not set lexer: %w",err)
|
||||
return fmt.Errorf("could not set lexer: %w", err)
|
||||
}
|
||||
|
||||
// Configure the input device. We know that defaults are set, so no need to
|
||||
|
|
Loading…
Reference in New Issue