From 00d07f58cd88a1e9dd13deed75ad1af3db6ebcf6 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期二, 17 十二月 2019 16:07:01 +0800
Subject: [PATCH] udpate

---
 main.go |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/main.go b/main.go
index a0d3545..0c7c0fa 100644
--- a/main.go
+++ b/main.go
@@ -15,7 +15,6 @@
 	"golang.org/x/sys/unix"
 
 	"basic.com/valib/gogpu.git"
-	"basic.com/valib/gosdk.git"
 	// "net/http"
 	// _ "net/http/pprof"
 )
@@ -28,6 +27,7 @@
 	gpu     int
 	shm     bool
 	ruleIPC string
+	soFile  string
 )
 
 const (
@@ -43,6 +43,8 @@
 	flag.StringVar(&id, "id", util.FakeSdkID, "sdk id as ipc label")
 	flag.IntVar(&gpu, "gpu", -1, "gpu index")
 	flag.BoolVar(&shm, "shm", false, "use shm for performance")
+
+	flag.StringVar(&soFile, "so-file", "./", "libcffmpeg.so path")
 
 	// 浜鸿劯璇嗗埆鍙傛暟
 	flag.IntVar(&util.SFI.DetectThrd, util.FaceDetectThread, util.SFI.DetectThrd, "face detect max thread count")
@@ -104,6 +106,7 @@
 
 	util.FillParams(util.RuleIPC, util.ToRuleIPC)
 
+	util.SetParams("-so-file=" + soFile)
 	util.SetParams("-gpu=" + strconv.Itoa(gpu))
 	if logit {
 		util.SetParams("-logit")
@@ -143,21 +146,23 @@
 	logo.Infoln(os.Args)
 	ctx, cancel := context.WithCancel(context.Background())
 
+	ret := false
 	if role == single {
-		proc.SingleRole(ctx, runType, id, gpu, shm)
+		ret = proc.SingleRole(ctx, runType, id, gpu, shm)
 	} else if role == master {
 		setParamters()
-		proc.MasterRole(ctx)
+		ret = proc.MasterRole(ctx)
 	} else if role == slave {
-		proc.SingleRole(ctx, runType, id, gpu, shm)
+		ret = proc.SingleRole(ctx, runType, id, gpu, shm)
 	}
 
-	c := make(chan os.Signal, 1)
-	signal.Notify(c, os.Interrupt, os.Kill, unix.SIGTERM)
-	<-c
+	if ret {
+		c := make(chan os.Signal, 1)
+		signal.Notify(c, os.Interrupt, os.Kill, unix.SIGTERM)
+		<-c
+	}
 
 	cancel()
 
-	gosdk.Free()
 	logo.Close()
 }

--
Gitblit v1.8.0