From 749eb5c2ee0bf0b7a8c914e7223c3a5deca3f16f Mon Sep 17 00:00:00 2001 From: lijun Date: Sat, 18 Jan 2025 14:34:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=88=86=E7=A6=BB=E7=9A=84?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E5=AD=98=E5=82=A8=E5=B8=A7?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=94=A8map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/tool.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/service/tool.go b/service/tool.go index 7e02d10..bf8a66a 100644 --- a/service/tool.go +++ b/service/tool.go @@ -65,8 +65,16 @@ func SetDeviceCurrentFrameV2(frame gocv.Mat, device_id int) error { //设置当前帧 switch device_id { case 1: + err := Device1CurrentFrame.Close() + if err != nil { + log.Println("设备1当前帧关闭失败") + } Device1CurrentFrame = frame case 50: + err := Device50CurrentFrame.Close() + if err != nil { + log.Printf("设备50当前帧关闭失败\n") + } Device50CurrentFrame = frame } frame_count, ok := DeviceFrameCount.Load(device_id) @@ -257,6 +265,11 @@ func getVideoFrame(device proto.DeviceInfo) { log.Printf("设备:%d 错误: 无法设置当前帧,err:%s \n", device.ID, err3.Error()) } z++ + //关闭帧 + err4 := frame.Close() + if err4 != nil { + log.Printf("设备:%d 错误: 无法关闭帧,err:%s \n", device.ID, err4.Error()) + } } }