From b111d988921e2a20c21f2772a54af1a16fa2aade Mon Sep 17 00:00:00 2001 From: Saxon1 Date: Sun, 6 May 2018 17:24:36 +0930 Subject: [PATCH] fixing issues --- revid/Revid.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/revid/Revid.go b/revid/Revid.go index 8db224a2..4035dcc5 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -135,7 +135,6 @@ func NewRevid(config Config) (r *revid, err error) { return } r.outputChan = make(chan []byte, outputChanSize) - r.parser.Start() go r.packClips() return } @@ -209,7 +208,6 @@ func (r *revid) changeState(config Config) error { // to perform packetization r.getFrame = r.getFramePacketization r.parser.SetOutputChan(r.generator.GetInputChan()) - r.generator.Start() noPacketizationSetup: return nil @@ -262,6 +260,10 @@ func (r *revid) Start() { } } go r.setupInput() + + r.parser.Start() + r.generator.Start() + go r.outputClips() r.isRunning = true } @@ -328,7 +330,7 @@ func (r *revid) packClips() { // Get some memory from the ring buffer for out clip var clip []byte var err error - if clip, err = r.ringBuffer.Get(); err != nil { + if clip, err = r.ringBuffer.Get(); err != nil && r.isRunning { r.Log(Error, err.Error()) r.Log(Warning, "Clearing output chan!") for clip, err = r.ringBuffer.Get(); err != nil && r.isRunning; {