From b6580af65e387b8afcfcd69785e348b04d6c72d1 Mon Sep 17 00:00:00 2001 From: Trek H Date: Wed, 12 Aug 2020 11:04:45 +0930 Subject: [PATCH] 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")