diff --git a/handler/tool.go b/handler/tool.go index 7b980c0..6ae2356 100644 --- a/handler/tool.go +++ b/handler/tool.go @@ -213,10 +213,11 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { //定时器,发送计数器 t_count := 0 t := 0 + img := gocv.NewMat() //计算帧率 for { //从service获取当前帧 - img, c := service.GetDeviceCurrentFrameV3(device_id) + c := service.GetDeviceCurrentFrameV2(&img, device_id) if c != count { if c == -1 { log.Printf("device:%d get frame err!", device_id) @@ -269,6 +270,11 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) { t_count++ } + err5 := img.Close() + if err5 != nil { + log.Printf("img close err:%v", err5) + } + // 查看是否还有其他连接,没有则设置 is_play 为 0 if worker.IsContainKey(online_conn_key) == false { worker.SetRedisWithExpire(strconv.Itoa(device_id)+"_is_play", "1", time.Minute*5)