From 611d12371729d0e9f4a36b74d08f5c2deb4b71c8 Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期日, 19 一月 2020 15:35:47 +0800 Subject: [PATCH] bug fixed and format log --- run.go | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/run.go b/run.go index 290607d..9e51f9d 100644 --- a/run.go +++ b/run.go @@ -120,8 +120,8 @@ postPush = `_1` ) - ipcSnd := url + postPush - ipcRcv := url + postPull + ipcSnd := s.ipc + postPush + ipcRcv := s.ipc + postPull sndURL := sdkhelper.GetIpcAddress(true, ipcSnd) rcvURL := sdkhelper.GetIpcAddress(true, ipcRcv) @@ -144,20 +144,24 @@ return case msg := <-chMsg: if len(msg.Tasklab.Sdkinfos) == 0 || int(msg.Tasklab.Index) >= len(msg.Tasklab.Sdkinfos) { + s.fnLogger("reid !!!!!! Recv Msg From Humantrack Error") continue } i := sdkhelper.UnpackImage(msg, "reid", s.fnLogger) if i == nil || i.Data == nil || i.Width <= 0 || i.Height <= 0 { - s.fnLogger("reid !!!!!! unpack image error") + s.fnLogger("reid !!!!!! Unpack Image From Humantrack Msg Failed") continue } sdkInfo := msg.Tasklab.Sdkinfos[int(msg.Tasklab.Index)] + s.fnLogger("reid !!!!!! Recv From Humantrack SDK Result Length: ", len(sdkInfo.Sdkdata)) + res := &protomsg.HumanTrackResult{} if err := proto.Unmarshal(sdkInfo.Sdkdata, res); err != nil { - s.fnLogger(err, " sdkinfo msg Unmarshal 澶勭悊寮傚父") + s.fnLogger("reid !!!!!! proto.Unmarshal SDK Result From Humantrack msg Error:", err) continue } + for _, v := range res.Result { var clen C.int @@ -174,18 +178,23 @@ } - if out, err := proto.Marshal(res); err == nil { - msg.Tasklab.Sdkinfos[int(msg.Tasklab.Index)].Sdkdata = out - nMsg := protomsg.SdkMessage{} - - if data, err := proto.Marshal(&nMsg); err == nil { - if data == nil { - s.fnLogger(err, " msg Marshal 澶勭悊寮傚父") - continue - } - chSnd <- data + if len(res.Result) > 0 { + if out, err := proto.Marshal(res); err == nil { + msg.Tasklab.Sdkinfos[int(msg.Tasklab.Index)].Sdkdata = out } } + + if data, err := proto.Marshal(&msg); err == nil { + if data == nil { + s.fnLogger("reid !!!!!! proto.Marshal Failed To Marshal proto.SdkMessage") + continue + } + s.fnLogger("reid !!!!!! Send To Humantrack Result Length:", len(data)) + + chSnd <- data + } else { + s.fnLogger("reid !!!!!! proto.Marshal Out Msg Error:", err) + } default: time.Sleep(10 * time.Millisecond) -- Gitblit v1.8.0