vidforward: use consistent revid construction function

This commit is contained in:
Saxon Nelson-Milton 2023-03-12 19:40:26 +10:30
parent a4754e5ead
commit c82d7a8e55
2 changed files with 14 additions and 25 deletions

View File

@ -39,10 +39,8 @@ import (
"time"
"bitbucket.org/ausocean/av/cmd/vidforward/global"
"bitbucket.org/ausocean/av/codec/codecutil"
"bitbucket.org/ausocean/av/container/mts"
"bitbucket.org/ausocean/av/revid"
"bitbucket.org/ausocean/av/revid/config"
"bitbucket.org/ausocean/utils/logging"
"gopkg.in/natefinch/lumberjack.v2"
)
@ -281,22 +279,8 @@ func (m *broadcastManager) createOrUpdate(broadcast Broadcast) error {
m.mu.Lock()
defer m.mu.Unlock()
var outputs []uint8
for _ = range broadcast.urls {
outputs = append(outputs, config.OutputRTMP)
}
cfg := config.Config{
Logger: m.log,
Input: config.InputManual,
InputCodec: codecutil.H264_AU,
Outputs: outputs,
RTMPURL: broadcast.urls,
LogLevel: logging.Debug,
}
var err error
broadcast.rv, err = revid.New(cfg, nil)
broadcast.rv, err = newRevid(m.log, broadcast.urls)
if err != nil {
return fmt.Errorf("could not initialise revid: %w", err)
}

View File

@ -38,15 +38,20 @@ import (
var loggingLevel = logging.Info
func newRevid(log logging.Logger, urls []string) (*revid.Revid, error) {
var outputs []uint8
for _ = range urls {
outputs = append(outputs, config.OutputRTMP)
}
cfg := config.Config{
Logger: log,
Input: config.InputManual,
InputCodec: codecutil.H264_AU,
Outputs: outputs,
RTMPURL: urls,
LogLevel: logging.Debug,
}
return revid.New(
config.Config{
Logger: log,
Input: config.InputManual,
InputCodec: codecutil.H264_AU,
Outputs: []uint8{config.OutputRTMP},
RTMPURL: urls,
LogLevel: loggingLevel,
}, nil)
cfg, nil)
}
// writeError logs an error and writes to w in JSON format.