fixing issues

This commit is contained in:
Saxon1 2018-05-06 17:24:36 +09:30
parent 145708c334
commit b111d98892
1 changed files with 5 additions and 3 deletions

View File

@ -135,7 +135,6 @@ func NewRevid(config Config) (r *revid, err error) {
return return
} }
r.outputChan = make(chan []byte, outputChanSize) r.outputChan = make(chan []byte, outputChanSize)
r.parser.Start()
go r.packClips() go r.packClips()
return return
} }
@ -209,7 +208,6 @@ func (r *revid) changeState(config Config) error {
// to perform packetization // to perform packetization
r.getFrame = r.getFramePacketization r.getFrame = r.getFramePacketization
r.parser.SetOutputChan(r.generator.GetInputChan()) r.parser.SetOutputChan(r.generator.GetInputChan())
r.generator.Start()
noPacketizationSetup: noPacketizationSetup:
return nil return nil
@ -262,6 +260,10 @@ func (r *revid) Start() {
} }
} }
go r.setupInput() go r.setupInput()
r.parser.Start()
r.generator.Start()
go r.outputClips() go r.outputClips()
r.isRunning = true r.isRunning = true
} }
@ -328,7 +330,7 @@ func (r *revid) packClips() {
// Get some memory from the ring buffer for out clip // Get some memory from the ring buffer for out clip
var clip []byte var clip []byte
var err error 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(Error, err.Error())
r.Log(Warning, "Clearing output chan!") r.Log(Warning, "Clearing output chan!")
for clip, err = r.ringBuffer.Get(); err != nil && r.isRunning; { for clip, err = r.ringBuffer.Get(); err != nil && r.isRunning; {