使用分离方式,修改视频流返回方式
This commit is contained in:
parent
8de01c90c2
commit
a12a055e53
|
|
@ -23,17 +23,17 @@ var Device1CurrentFrame gocv.Mat
|
|||
var Device50CurrentFrame gocv.Mat
|
||||
var Device73CurrentFrame gocv.Mat
|
||||
|
||||
func SetDeviceCurrentFrame(frame *gocv.Mat, device_id int) error {
|
||||
func SetDeviceCurrentFrame(frame *gocv.Mat, deviceId int) error {
|
||||
//获取读写锁
|
||||
mutex_, ok := DeviceRWMap.Load(device_id)
|
||||
mutex_, ok := DeviceRWMap.Load(deviceId)
|
||||
if !ok {
|
||||
return fmt.Errorf("设备:%s 读写锁不存在", device_id)
|
||||
return fmt.Errorf("设备:%s 读写锁不存在", deviceId)
|
||||
}
|
||||
mutex := mutex_.(*sync.RWMutex)
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
//设置当前帧
|
||||
switch device_id {
|
||||
switch deviceId {
|
||||
case 1:
|
||||
if Device1CurrentFrame.Empty() {
|
||||
Device1CurrentFrame = gocv.NewMatWithSize((*frame).Rows(), (*frame).Cols(), (*frame).Type())
|
||||
|
|
@ -51,12 +51,12 @@ func SetDeviceCurrentFrame(frame *gocv.Mat, device_id int) error {
|
|||
(*frame).CopyTo(&Device73CurrentFrame)
|
||||
}
|
||||
|
||||
frameCount, ok := DeviceFrameCount[device_id]
|
||||
frameCount, ok := DeviceFrameCount[deviceId]
|
||||
if !ok {
|
||||
return fmt.Errorf("设备:%s 当前帧计数不存在", device_id)
|
||||
return fmt.Errorf("设备:%s 当前帧计数不存在", deviceId)
|
||||
}
|
||||
frameCount++
|
||||
DeviceFrameCount[device_id] = frameCount
|
||||
DeviceFrameCount[deviceId] = frameCount
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue