修复部分获取视频逻辑
This commit is contained in:
parent
31fddec772
commit
3aaf9b77b3
1
main.go
1
main.go
|
|
@ -64,6 +64,7 @@ func init() {
|
||||||
for _, device := range proto.Config.DeviceInfo {
|
for _, device := range proto.Config.DeviceInfo {
|
||||||
service.DeviceRWMap[device.ID] = sync.RWMutex{}
|
service.DeviceRWMap[device.ID] = sync.RWMutex{}
|
||||||
service.DeviceCurrentFrameMap[device.ID] = gocv.NewMat()
|
service.DeviceCurrentFrameMap[device.ID] = gocv.NewMat()
|
||||||
|
service.DeviceIsStop[device.ID] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,10 @@ func Get(url string) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVideoStream(id int) {
|
func GetVideoStream(id int) {
|
||||||
|
if DeviceIsStop[id] == false {
|
||||||
|
fmt.Println("device:", id, " is running!")
|
||||||
|
return
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
var device proto.DeviceInfo
|
var device proto.DeviceInfo
|
||||||
var index int
|
var index int
|
||||||
|
|
@ -129,14 +133,12 @@ func GetVideoStream(id int) {
|
||||||
DeviceIsStop[id] = true
|
DeviceIsStop[id] = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if DeviceIsStop[id] == false {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
//设置设备控制信息
|
//设置设备控制信息
|
||||||
status := Get(device.Control)
|
status := Get(device.Control)
|
||||||
DeviceIsStop[id] = false
|
DeviceIsStop[id] = false
|
||||||
log.Println("device:", device.ID, " set control info status:", status)
|
log.Println("device:", device.ID, " set control info status:", status)
|
||||||
getVideoFrame(device)
|
getVideoFrame(device)
|
||||||
|
DeviceIsStop[id] = true //停止之后,设置已停止信息
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue