From 4e7e5ebca3cd5fa95f448dbf3f3baf7cb7788639 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 24 Jan 2020 20:15:40 +1030 Subject: [PATCH] revid/revid.go: cleaned up prcoessFrom (added deger for waitgroup.Done and added info log) --- revid/revid.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/revid/revid.go b/revid/revid.go index b442e34a..7aca384e 100644 --- a/revid/revid.go +++ b/revid/revid.go @@ -857,17 +857,19 @@ func (r *Revid) Update(vars map[string]string) error { // processFrom is run as a routine to read from a input data source, lex and // then send individual access units to revid's encoders. func (r *Revid) processFrom(in device.AVDevice, delay time.Duration) { + defer r.wg.Done() + restart: err := in.Start() if err != nil { r.err <- fmt.Errorf("could not start input device: %w", err) - r.wg.Done() return } // Lex data from input device, in, until finished or an error is encountered. // For a continuous source e.g. a camera or microphone, we should remain // in this call indefinitely unless in.Stop() is called and an io.EOF is forced. + r.cfg.Logger.Log(logger.Info, pkg+"lexing") err = r.lexTo(r.filters[0], in, delay) switch err { case nil, io.EOF, io.ErrUnexpectedEOF: @@ -886,5 +888,4 @@ restart: } r.cfg.Logger.Log(logger.Info, pkg+"finished lexing") - r.wg.Done() }