视频分析2.0 多进程拆分仓库
zhangmeng
2019-05-07 ed1a15629804de57b08906a9d862b05afe44f006
decoder/main.go
@@ -48,9 +48,6 @@
var (
   mapCameraInfo = make(map[string]CameraInfo)
   tcp  = `tcp://192.168.1.124:`
   port = 7001
)
func recvCameraInfoFromIPC(ctx context.Context, url string, ch chan<- CameraInfo) {
@@ -69,7 +66,7 @@
            ch <- c
            msgIpc := MsgIPC{"new decoder", port}
            msgIpc := MsgIPC{"new decoder", 0}
            if b, err := json.Marshal(msgIpc); err == nil {
               ipc.Send(b)
            }
@@ -91,8 +88,19 @@
   ctx, cancel := context.WithCancel(context.Background())
   ch := make(chan CameraInfo)
   // tcpURL := tcp + strconv.Itoa(port)
   // port++
   tcp := ``
   port := 7001
   if strings.Index(ipcURL, "tcp://") == 0 {
      i := strings.LastIndex(ipcURL, ":")
      tcp = ipcURL[0 : i+1]
      strPort := ipcURL[i+1:]
      port, _ = strconv.Atoi(strPort)
      port++
   }
   go recvCameraInfoFromIPC(ctx, ipcURL, ch)
   for {