使用分离的全局变量存储帧,不用map
This commit is contained in:
parent
f83e720224
commit
749eb5c2ee
|
|
@ -65,8 +65,16 @@ func SetDeviceCurrentFrameV2(frame gocv.Mat, device_id int) error {
|
||||||
//设置当前帧
|
//设置当前帧
|
||||||
switch device_id {
|
switch device_id {
|
||||||
case 1:
|
case 1:
|
||||||
|
err := Device1CurrentFrame.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Println("设备1当前帧关闭失败")
|
||||||
|
}
|
||||||
Device1CurrentFrame = frame
|
Device1CurrentFrame = frame
|
||||||
case 50:
|
case 50:
|
||||||
|
err := Device50CurrentFrame.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("设备50当前帧关闭失败\n")
|
||||||
|
}
|
||||||
Device50CurrentFrame = frame
|
Device50CurrentFrame = frame
|
||||||
}
|
}
|
||||||
frame_count, ok := DeviceFrameCount.Load(device_id)
|
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())
|
log.Printf("设备:%d 错误: 无法设置当前帧,err:%s \n", device.ID, err3.Error())
|
||||||
}
|
}
|
||||||
z++
|
z++
|
||||||
|
//关闭帧
|
||||||
|
err4 := frame.Close()
|
||||||
|
if err4 != nil {
|
||||||
|
log.Printf("设备:%d 错误: 无法关闭帧,err:%s \n", device.ID, err4.Error())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue