This commit is contained in:
laodaming 2023-09-12 11:05:52 +08:00
parent 0015ef7540
commit 0eaa357de5

View File

@ -75,12 +75,17 @@ func (w *wsConnectItem) consumeRenderImageData() {
logx.Error("func renderImage err:", err)
}
}()
tick := time.Tick(w.extendRenderProperty.renderConsumeTickTime)
var duration time.Duration = 1
if w.extendRenderProperty.renderConsumeTickTime > 0 {
duration = w.extendRenderProperty.renderConsumeTickTime
}
ticker := time.NewTicker(duration)
defer ticker.Stop()
for {
select {
case <-w.closeChan: //已关闭
return
case <-tick: //消费数据
case <-ticker.C: //消费数据
w.renderImage(<-w.extendRenderProperty.renderChan)
}
}