From b6580af65e387b8afcfcd69785e348b04d6c72d1 Mon Sep 17 00:00:00 2001 From: Trek H Date: Wed, 12 Aug 2020 11:04:45 +0930 Subject: [PATCH 1/5] revid: fixed bugs to do with lex timing for audio --- revid/revid.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 75d06e76..e1ba16ad 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -211,6 +211,7 @@ func (r *Revid) reset(c config.Config) error { } case config.InputAudio: st = mts.EncodeAudio + encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second)) default: panic("unknown input type") } @@ -460,10 +461,16 @@ func (r *Revid) Start() error { } r.cfg.Logger.Log(logger.Info, "revid reset") - // Calculate delay between frames based on FileFPS. + // Calculate delay between frames based on FileFPS for Video or RecPeriod for audio. d := time.Duration(0) - if r.cfg.FileFPS != 0 { - d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond + if r.cfg.Input == config.InputAudio { + if r.cfg.RecPeriod != 0 { + d = time.Duration(r.cfg.RecPeriod * float64(time.Second)) + } + } else { + if r.cfg.FileFPS != 0 { + d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond + } } r.cfg.Logger.Log(logger.Debug, "starting input processing routine") From ddf9707d95adf95a7664dfe7d6295b6cfe23528c Mon Sep 17 00:00:00 2001 From: Trek H Date: Thu, 13 Aug 2020 16:25:37 +0930 Subject: [PATCH 2/5] revid: change comment --- revid/revid.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/revid/revid.go b/revid/revid.go index e1ba16ad..383e3253 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -461,7 +461,8 @@ func (r *Revid) Start() error { } r.cfg.Logger.Log(logger.Info, "revid reset") - // Calculate delay between frames based on FileFPS for Video or RecPeriod for audio. + // Calculate delay between frames based on FileFPS for Video or + // between recording periods for audio. d := time.Duration(0) if r.cfg.Input == config.InputAudio { if r.cfg.RecPeriod != 0 { From 6ecce76602e7bb97f77f9e5688b452b8edb5a391 Mon Sep 17 00:00:00 2001 From: Trek H Date: Fri, 14 Aug 2020 12:20:51 +0930 Subject: [PATCH 3/5] revid: improve comments --- go.sum | 1 + revid/revid.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.sum b/go.sum index 0537db2b..5b5ce051 100644 --- a/go.sum +++ b/go.sum @@ -66,6 +66,7 @@ golang.org/x/image v0.0.0-20200119044424-58c23975cae1 h1:5h3ngYt7+vXCDZCup/HkCQg golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/revid/revid.go b/revid/revid.go index 41b83602..23f8cd68 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -455,7 +455,7 @@ func (r *Revid) Start() error { } r.cfg.Logger.Log(logger.Info, "revid reset") - // Calculate delay between frames based on FileFPS for Video or + // Calculate delay between frames based on FileFPS for video or // between recording periods for audio. d := time.Duration(0) if r.cfg.Input == config.InputAudio { From 7cf449b5c9944bbc5323632f33a5a8d743e2668e Mon Sep 17 00:00:00 2001 From: Trek H Date: Fri, 14 Aug 2020 12:34:20 +0930 Subject: [PATCH 4/5] revid: simplify --- revid/revid.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 23f8cd68..1952f889 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -459,11 +459,9 @@ func (r *Revid) Start() error { // between recording periods for audio. d := time.Duration(0) if r.cfg.Input == config.InputAudio { - if r.cfg.RecPeriod != 0 { d = time.Duration(r.cfg.RecPeriod * float64(time.Second)) } - } else { - if r.cfg.FileFPS != 0 { + } else if r.cfg.FileFPS != 0 { d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond } } From 3ec7eddfedfc7d6cf3c9798036ef65401322d1c8 Mon Sep 17 00:00:00 2001 From: Trek H Date: Fri, 14 Aug 2020 12:54:07 +0930 Subject: [PATCH 5/5] revid: syntax --- revid/revid.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index 1952f889..e28b44ca 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -459,11 +459,9 @@ func (r *Revid) Start() error { // between recording periods for audio. d := time.Duration(0) if r.cfg.Input == config.InputAudio { - d = time.Duration(r.cfg.RecPeriod * float64(time.Second)) - } + d = time.Duration(r.cfg.RecPeriod * float64(time.Second)) } else if r.cfg.FileFPS != 0 { - d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond - } + d = time.Duration(1000/r.cfg.FileFPS) * time.Millisecond } r.cfg.Logger.Log(logger.Debug, "starting input processing routine")