From f0a94d4d1d468ebecb76b63e72cd9ada4915446e Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 19 十二月 2019 14:31:31 +0800
Subject: [PATCH] update

---
 work/sdk/humantrack.go |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/work/sdk/humantrack.go b/work/sdk/humantrack.go
index dae08ae..c4619bd 100644
--- a/work/sdk/humantrack.go
+++ b/work/sdk/humantrack.go
@@ -36,10 +36,11 @@
 		flag:      flag,
 		list:      NewLockList(6),
 
-		recvImageCount: 0,
-		index:          0,
-		images:         make([]*gohumantrack.ImageHumanTracker, batchSize),
-		msgs:           make([]*work.MsgRS, batchSize),
+		recvImageCount:        0,
+		index:                 0,
+		t.mapCameraImageIndex: make(map[string]int),
+		images:                make([]*gohumantrack.ImageHumanTracker, batchSize),
+		msgs:                  make([]*work.MsgRS, batchSize),
 	}
 }
 
@@ -126,21 +127,6 @@
 	// mapCameraImageIndex map[string]int
 	// images              []gohumantrack.ImageHumanTracker
 
-	if t.mapCameraImageIndex == nil {
-		t.recvImageCount = 0
-		t.index = 0
-
-		t.mapCameraImageIndex = make(map[string]int)
-		for i := 0; i < t.batchSize; i++ {
-			t.images[i] = nil
-		}
-		for i := 0; i < t.batchSize; i++ {
-			t.msgs[i] = nil
-		}
-	}
-
-	t.recvImageCount++
-
 	if i, ok := t.mapCameraImageIndex[rMsg.Msg.Cid]; ok {
 		if i < t.batchSize {
 			t.images[i] = &img
@@ -154,6 +140,8 @@
 		}
 		t.index++
 	}
+	t.recvImageCount++
+
 	if t.recvImageCount < t.batchSize+t.batchSize/2 {
 		logo.Infoln("batch~~~~~~Current Index: ", t.index)
 		return

--
Gitblit v1.8.0