From 02a7738c495bd4702ae1029905311b98809dea7c Mon Sep 17 00:00:00 2001 From: lijun Date: Wed, 22 Jan 2025 14:28:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/tool.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)