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
}
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; {