Compare commits
No commits in common. "90e64920c7c41dfdb5055704dcc3ed85acb87dfc" and "7d55d68c904274a4637c4456a1965abb39fbb43c" have entirely different histories.
90e64920c7
...
7d55d68c90
|
|
@ -213,9 +213,10 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
||||||
count := 0
|
count := 0
|
||||||
//定时器,发送计数器
|
//定时器,发送计数器
|
||||||
t_count := 0
|
t_count := 0
|
||||||
|
img := gocv.NewMat()
|
||||||
for {
|
for {
|
||||||
//从service获取当前帧
|
//从service获取当前帧
|
||||||
img, c := service.GetDeviceCurrentFrameV3(device_id)
|
c := service.GetDeviceCurrentFrameV2(&img, device_id)
|
||||||
if c != count {
|
if c != count {
|
||||||
if c == -1 {
|
if c == -1 {
|
||||||
log.Printf("device:%d get frame err!", device_id)
|
log.Printf("device:%d get frame err!", device_id)
|
||||||
|
|
@ -242,10 +243,6 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
c = count
|
c = count
|
||||||
err5 := img.Close()
|
|
||||||
if err5 != nil {
|
|
||||||
log.Printf("img close err:%v", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//每秒发送一次心跳检测
|
//每秒发送一次心跳检测
|
||||||
|
|
@ -263,6 +260,11 @@ func subscribeAndHandleMessagesV3(ws *websocket.Conn, device_id int) {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
t_count++
|
t_count++
|
||||||
}
|
}
|
||||||
|
// 关闭img
|
||||||
|
err := img.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("device:%d img close err:%v", device_id, err)
|
||||||
|
}
|
||||||
|
|
||||||
// 查看是否还有其他连接,没有则设置 is_play 为 0
|
// 查看是否还有其他连接,没有则设置 is_play 为 0
|
||||||
if worker.IsContainKey(online_conn_key) == false {
|
if worker.IsContainKey(online_conn_key) == false {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue