* vidforward: actually set revid pipeline

We need to actually get the returned value from
initOrStartPipeline and set the pipeline.

* vidforward: add some logging to config load

* vidforward: update utils version

Approved-by: Alan Noble
Approved-by: Trek Hopton
This commit is contained in:
Saxon Milton 2023-10-14 00:49:42 +00:00
parent c98fffe722
commit 524e010fe1
3 changed files with 14 additions and 6 deletions

View File

@ -147,6 +147,7 @@ func (m *broadcastManager) loadConfig() error {
m.mu.Lock()
defer m.mu.Unlock()
m.log.Info("loading logger config file")
data, err := ioutil.ReadFile(configFileName)
if err != nil {
return fmt.Errorf("could not read config file: %w", err)
@ -162,6 +163,7 @@ func (m *broadcastManager) loadConfig() error {
return fmt.Errorf("could not unmarshal config file: %w", err)
}
m.log.Debug("logger config loaded","cfg",cfg)
m.log.(*logging.JSONLogger).SetLevel(map[string]int8{
"debug": logging.Debug,
"info": logging.Info,
@ -380,11 +382,17 @@ func (m *broadcastManager) getPipeline(ma MAC) (*revid.Revid, error) {
panic("shouldn't be getting pipeline if this mac isn't registered")
}
return m.initOrStartPipeline(b.rv, b.urls)
var err error
b.rv, err = m.initOrStartPipeline(b.rv, b.urls)
if err != nil {
return nil, fmt.Errorf("could not init or start pipeline: %v",err)
}
return b.rv, nil
}
// initOrStartPipeline ensures that provided Revid pointer points to an
// initialised and running revid pipeline.
// initialised and running revid pipeline.
func (m *broadcastManager) initOrStartPipeline(rv *revid.Revid, urls []string) (*revid.Revid, error){
var err error
if rv == nil {
@ -439,7 +447,7 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
maybeOld = &broadcast
}
var err error
var err error
maybeOld.rv, err = m.initOrStartPipeline(maybeOld.rv, broadcast.urls)
if err != nil {
return fmt.Errorf("could not get revid pipeline: %w", err)

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.18
require (
bitbucket.org/ausocean/iot v1.4.1
bitbucket.org/ausocean/utils v1.4.0
bitbucket.org/ausocean/utils v1.4.1
github.com/Comcast/gots v0.0.0-20190305015453-8d56e473f0f7
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
github.com/go-audio/audio v0.0.0-20181013203223-7b2a6ca21480

4
go.sum
View File

@ -3,8 +3,8 @@ bitbucket.org/ausocean/iot v1.4.1 h1:PcRu9dS5CbKyw1FZjEc4MR9CQ+ku9MkH9ZjA0f6Mm1c
bitbucket.org/ausocean/iot v1.4.1/go.mod h1:NbEg2PvYSHDdUsy5eMmihBySpWfqaHiMdspQDZdDe8o=
bitbucket.org/ausocean/utils v1.2.11/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8=
bitbucket.org/ausocean/utils v1.3.0/go.mod h1:yWsulKjbBgwL17/w55MQ6cIT9jmNeOkwpd2gUIxAcIY=
bitbucket.org/ausocean/utils v1.4.0 h1:ceNRscC49fAVY9tIOAN3Jyg7g+A9JTKjqgxEGb7A+9E=
bitbucket.org/ausocean/utils v1.4.0/go.mod h1:XgvCH4DQLCd6NYMzsSqwhHmPr+qzYks5M8IDpdNnZiU=
bitbucket.org/ausocean/utils v1.4.1 h1:UTxWBy8vDFq5b77rq8vzuZmHW9Unxok3AcoxP9nuvvI=
bitbucket.org/ausocean/utils v1.4.1/go.mod h1:XgvCH4DQLCd6NYMzsSqwhHmPr+qzYks5M8IDpdNnZiU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=