revid: fixed bugs to do with lex timing for audio

This commit is contained in:
Trek H 2020-08-12 11:04:45 +09:30
parent 53a55cc477
commit b6580af65e
1 changed files with 10 additions and 3 deletions

View File

@ -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")