From 5cf652629fb40796cd2e0ab17c3617ed52365473 Mon Sep 17 00:00:00 2001
From: pans <pans@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 18 八月 2017 10:32:05 +0800
Subject: [PATCH] capnp client fix bug

---
 VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java   |   32 ++++---
 VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.h                                 |    1 
 VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp                        |   34 ++------
 VisitFace/RtspNativeCodec/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java |   21 +++--
 VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperClient.cpp                     |    6 +
 VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp                        |   39 +--------
 VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.cpp                               |    5 +
 VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNIClient.cpp                |   71 ++++++++++-------
 8 files changed, 95 insertions(+), 114 deletions(-)

diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.cpp
index 8530024..066053a 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.cpp
@@ -8,6 +8,11 @@
 {
 }
 
+AppConfig::AppConfig(string path)
+{
+	loadConfig(path);
+}
+
 AppConfig::~AppConfig()
 {
 }
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.h b/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.h
index ebbf22b..3ce1489 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.h
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/AppConfig.h
@@ -18,6 +18,7 @@
 public:
 	AppConfig();
 	~AppConfig();
+	AppConfig(string path);
 
 	string getStringValue(string key);
 	int getIntValue(string key);
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperClient.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperClient.cpp
index e2d99da..b81d341 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperClient.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/CameraWrapperClient.cpp
@@ -202,13 +202,14 @@
     faceCacheLocked = false;
 }
 
+//#Deprecated
 void CameraWrapper::setFaceLabel(int st_track_id, const std::wstring& label)
 {
     if (faceLabels.size() > 32)
         faceLabels.clear();
 
     faceLabels.insert(std::make_pair(st_track_id, label));
-    LOG_ERROR <<"client setFaceLabel : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"client setFaceLabel : !!!!!!"<< LOG_ENDL;
 }
 
 void CameraWrapper::fireFaceCount(int faceCount)
@@ -375,6 +376,7 @@
     }
 }
 
+//callback pthread
 void *CameraWrapper::jni_call_thd(void *arg) {
 
     CameraWrapper* cameraWrapper = (CameraWrapper*)arg;
@@ -410,7 +412,7 @@
             cameraWrapper->javaVM->DetachCurrentThread();
             cameraWrapper->faceCountChanged = false;
         }
-        usleep(10000);
+        usleep(50000);
     }
 
 }
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp
index 623fdc0..ad5210f 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncClient.cpp
@@ -5,37 +5,20 @@
 #include "RemoteFuncClient.h"
 #include "RemoteFunc.h"
 #include "RtspNativeCodecJNIClient.h"
+#include "AppConfig.h"
 
 #include <string>
 #include <iostream>
 using namespace std;
 
-//#todo 淇敼鏈嶅姟绾跨▼鏋勯�犲弬鏁颁紶鍏ユ柟寮�
-RemoteServer<RtspFaceDetectImpl> remoteServer("192.168.1.97", 8111);
+AppConfig config("data/config.cfg");
+RemoteServer<RtspFaceDetectImpl> remoteServer(config.getStringValue("local_ip"), config.getIntValue("local_port"));
+//RemoteServer<RtspFaceDetectImpl> remoteServer("192.168.1.97", 8111);
 static RtspFaceViewClient* rtspFaceViewClient = nullptr;
 
 void startRemoteServer()
 {
-	LOG_ERROR << "pansen : this is clinet" << std::endl;
 	remoteServer.start();
-
-    //#todo 璋冪敤浣嶇疆绉诲姩
-//    try
-//    {
-//        RtspFaceViewClient rtspFaceViewClient = RtspFaceViewClient();
-//        RtspFaceView::Client& rClient = rtspFaceViewClient.getClient();
-//
-//        auto& waitScope = rtspFaceViewClient.getWaitScope();
-//        //auto  request = rClient.abcdef();
-//       // auto sendAct = request.send();
-//       // sendAct.wait(waitScope);
-//    }
-//    catch (const kj::Exception& e)
-//    {
-//        cout << e.getDescription().cStr() << endl;
-//        return;
-//    }
-    //#end
 }
 
 RtspFaceViewClient * getRtspFaceViewClient()
@@ -76,9 +59,8 @@
     if (rpcClient == nullptr) {
         try
         {
-            //#todo ip modify
-            rpcClient = new capnp::EzRpcClient("192.168.1.94", 8112);
-            //rpcClient = new capnp::EzRpcClient("192.168.1.71", 8112);
+            //rpcClient = new capnp::EzRpcClient("192.168.1.116", 8112);
+            rpcClient = new capnp::EzRpcClient(config.getStringValue("server_ip"), config.getIntValue("server_port"));
         }
         catch (const kj::Exception& e)
         {
@@ -93,8 +75,8 @@
 ::kj::Promise<void> RtspFaceDetectImpl::fireFaceCountListener(FireFaceCountListenerContext context)
 {
 	auto results = context.getResults();
-    LOG_ERROR << "!!!!!!!!!!!!!!!!!!!!!WHO  find face!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << LOG_ENDL;
+    LOG_ERROR << "!!!!!!!!!!!!!!!!!!!!!WHO  find face!!!!!!!" << LOG_ENDL;
 	remoteFireFaceCountListener(context.getParams(), results);
-    context.setResults(results);
+    //context.setResults(results);
     return kj::READY_NOW;
 }
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp
index 3c77217..2b47182 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RemoteFuncServer.cpp
@@ -10,34 +10,14 @@
 #include <iostream>
 using namespace std;
 
-//#todo 淇敼鏈嶅姟绾跨▼鏋勯�犲弬鏁颁紶鍏ユ柟寮�
-RemoteServer<RtspFaceViewImpl> remoteServer("192.168.1.94", 8112);
+AppConfig config("data/config.cfg");
+RemoteServer<RtspFaceViewImpl> remoteServer(config.getStringValue("local_ip"), config.getIntValue("local_port"));
 //RemoteServer<RtspFaceViewImpl> remoteServer("192.168.1.97", 8112);
 static RtspFaceDetectClient* rtspFaceDetectClient = nullptr;
 
 void startRemoteServer()
 {
-;
-	AppConfig config;
-	config.loadConfig("data/config.cfg");
     remoteServer.start();
-//    //#todo 璋冪敤浣嶇疆绉诲姩
-//    try
-//    {
-//        RtspFaceDetectClient rtspFaceDetectClient = RtspFaceDetectClient();
-//        RtspFaceDetect::Client& rClient = rtspFaceDetectClient.getClient();
-//
-//        auto& waitScope = rtspFaceDetectClient.getWaitScope();
-//        auto  request = rClient.fireFaceCountListenerRequest();
-//        auto sendAct = request.send();
-//        sendAct.wait(waitScope);
-//    }
-//    catch (const kj::Exception& e)
-//    {
-//        cout << e.getDescription().cStr() << endl;
-//        return;
-//    }
-    //#end
 }
 
 RtspFaceDetectClient * getRtspFaceDetectClient()
@@ -84,10 +64,8 @@
     if (rpcClient == nullptr) {
         try
         {
-            //#todo ip test
-            //rpcClient = new capnp::EzRpcClient("192.168.1.89", 8111);
-            //client
-           rpcClient = new capnp::EzRpcClient("192.168.1.97", 8111);
+            // rpcClient = new capnp::EzRpcClient("192.168.1.97", 8111);
+            rpcClient = new capnp::EzRpcClient(config.getStringValue("server_ip"), config.getIntValue("server_port"));
         }
         catch (const kj::Exception& e)
         {
@@ -103,8 +81,7 @@
 {
 	auto results = context.getResults();
 	remoteGetFaceList(context.getParams(), results);
-	context.setResults(results);
-    LOG_ERROR <<"getFaceList : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"getFaceList : !!!!!!!!!!!!!!!"<< LOG_ENDL;
     return kj::READY_NOW;
 }
 
@@ -112,8 +89,7 @@
 {
 	auto results = context.getResults();
 	remoteGetFaceListImage(context.getParams(), results);
-	context.setResults(results);
-    LOG_ERROR <<"getFaceImages : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"getFaceImages : !!!!!!!!!!!!!!"<< LOG_ENDL;
     return kj::READY_NOW;
 }
 
@@ -121,7 +97,6 @@
 {
 	auto results = context.getResults();
 	remoteSetFaceLabel(context.getParams(), results);
-	context.setResults(results);
-    LOG_ERROR <<"setFaceLabel : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"setFaceLabel : !!!!!!!!!!!!"<< LOG_ENDL;
     return kj::READY_NOW;
 }
diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNIClient.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNIClient.cpp
index ae204ec..afffcb8 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNIClient.cpp
+++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNIClient.cpp
@@ -39,9 +39,9 @@
 const size_t _faceImagesSize = MAX_FACE * MAX_FACE_WIDTH * MAX_FACE_HEIGHT * 3;
 uint8_t _faceImages[_faceImagesSize]; // android stack is small
 
-// #todo optimize not copy data here, set data to jbyteArray directly
-//Java_cn_com_basic_face_util_RtspFaceNative_getFaceList
-// Y channel of YUV420p, packed in protobuf
+//// #todo optimize not copy data here, set data to jbyteArray directly
+////Java_cn_com_basic_face_util_RtspFaceNative_getFaceList
+//// Y channel of YUV420p, packed in protobuf
 static uint8_t buffer[MAX_FACE * MAX_FACE_WIDTH * MAX_FACE_HEIGHT] = {0};
 static size_t buffSize = sizeof(buffer);
 
@@ -73,12 +73,11 @@
         //PipeLine& pipeLine(*(g_CameraWrappers[i].pipeLineDecoderDetector));
     }
 
+
     g_TeleWrapper.start();
-    //pansen test Client start
-    LOG_ERROR << "pansen test Client start" << std::endl;
+
+    //capnp server start
     startRemoteServer();
-    LOG_ERROR << "pansen test Client end" << std::endl;
-    //pansen test Client end
 
 }
 
@@ -368,29 +367,34 @@
     LOG_DEBUG << "@@@ Java_cn_com_basic_face_util_RtspFaceNative_getFaceList" << LOG_ENDL;
     assert(cameraIdx > 0 && cameraIdx <= CAMERA_COUNT);
     cameraIdx -= 1;
+    if(cameraIdx <0){
+        cameraIdx += 1;
+    }
     CameraWrapper &cameraWrapper(g_CameraWrappers[cameraIdx]);
 
-
+    // Change to Global variable
+    //   uint8_t buffer[MAX_FACE * MAX_FACE_WIDTH * MAX_FACE_HEIGHT] = {0};
+    //  size_t buffSize = sizeof(buffer);
 
     bool ret = false;
 
     uint8_t *pBufPB = buffer + sizeof(EVPHeader) + sizeof(FDP_FaceDetectPB);
     buffSize = sizeof(buffer) - sizeof(EVPHeader) - sizeof(FDP_FaceDetectPB);
 
-// ps add -----8.11-----
+// add -----8.11-----calling getfacelist
     try
     {
-        LOG_ERROR <<"client : i want getFaceList!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+        LOG_ERROR <<"client : i want getFaceList!!!!!!!!!!!!"<< LOG_ENDL;
         RtspFaceViewClient* client = getRtspFaceViewClient();
         RtspFaceView::Client rClient = client->getEzRpcClient()->getMain<RtspFaceView>();
         //auto& waitScope =client->getEzRpcClient()->getWaitScope();
         auto& waitScope =client->getWaitScope();
         auto  request = rClient.getFaceListRequest();
-        request.setCameraIndex(cameraIdx);
+        request.setCameraIndex(cameraIdx+1);
         auto sendAct = request.send();
         auto  result = sendAct.wait(waitScope);
         ret = result.getFaceList().size() > 0;
-        LOG_DEBUG << "@@@ getFaceList get data" << LOG_ENDL;
+        LOG_DEBUG << "@@@ getFaceList get data!!!!!!!!!!!!!" << LOG_ENDL;
         memcpy(pBufPB,result.getFaceList().begin(),result.getFaceList().size());
     }
     catch (const kj::Exception& e){
@@ -402,7 +406,7 @@
         ret = false;
     }
     //-------end-------
-    LOG_ERROR <<"client : i want getFaceList   end!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"client : i want getFaceList   end!!!!!!!!!!!!!"<< LOG_ENDL;
     //ret = cameraWrapper.faceCache.getFaceListPb(pBufPB, buffSize);
 
     if (!ret)
@@ -464,8 +468,8 @@
 
 #ifdef USE_ST_SDK
 
-    //#ps add --------8.11-------
-    LOG_ERROR <<"client : i want getFaceImages!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    //#ps add --------8.11------- calling getfaceimages
+    LOG_ERROR <<"client : i want getFaceImages!!!!!!!!!!!!!!!!"<< LOG_ENDL;
     try
     {
         RtspFaceViewClient* client = getRtspFaceViewClient();
@@ -473,15 +477,17 @@
         auto& waitScope =client->getWaitScope();
 
         auto  request = rClient.getFaceImagesRequest();
-        request.setCameraIndex(cameraIdx);
+        request.setCameraIndex(cameraIdx+1);
         auto sendAct = request.send();
         auto result = sendAct.wait(waitScope);
         if(result.getImgIndexData().size() >0 && result.getImgData().size()>0)
         {
             ret =true;
-            LOG_DEBUG << "@@@ getFaceImages  get data" << LOG_ENDL;
+            LOG_DEBUG << "@@@ getFaceImages  get data!!!!!!!" << LOG_ENDL;
             memcpy(_faceImages,result.getImgData().begin(),result.getImgData().size());
-            memcpy(&imgIdxes ,result.getImgIndexData().begin() ,result.getImgIndexData().size());
+
+            imgIdxes.resize(result.getImgIndexData().size()/sizeof(NativeImgIdx));
+            memcpy(imgIdxes.data() ,result.getImgIndexData().begin() ,result.getImgIndexData().size());
         }
     }
     catch (const kj::Exception& e)
@@ -490,9 +496,9 @@
         ret = false;
         LOG_ERROR << "Java_cn_com_basic_face_util_RtspFaceNative_getFaceImages try fail" << LOG_ENDL;
     }
-    LOG_ERROR <<"client : i want getFaceImages    end!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"client : i want getFaceImages    end!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
     //-------end-------
-    ret = cameraWrapper.faceCache.getFaceListImage(imgIdxes, _faceImages, _faceImagesSize);
+    //ret = cameraWrapper.faceCache.getFaceListImage(imgIdxes, _faceImages, _faceImagesSize);
 #endif
 
     if (imgIdxes.size() == 0)
@@ -664,13 +670,12 @@
 void Java_cn_com_basic_face_util_RtspFaceNative_setFaceLabel(JNIEnv *env, jclass clazz, jint cameraIdx, jint stTrackId, jstring label)
 {
     LOG_DEBUG << "@@@ Java_cn_com_basic_face_util_RtspFaceNative_setFaceLabel" << LOG_ENDL;
-    LOG_ERROR <<"ps ------------start"<< LOG_ENDL;
+
     assert(cameraIdx > 0 && cameraIdx <= CAMERA_COUNT);
     cameraIdx -= 1;
     CameraWrapper &cameraWrapper(g_CameraWrappers[cameraIdx]);
     const jchar* jchars = env->GetStringChars(label, nullptr);
     std::wstring wstr;
-    LOG_ERROR <<"ps ------------4"<< LOG_ENDL;
     int lenth = env->GetStringLength(label);
 
     for (int i = 0; i < lenth; ++i) {
@@ -681,8 +686,8 @@
 
     env->ReleaseStringChars(label,jchars);
 
-    // ps add ------8.11---------
-    LOG_ERROR <<"client : i want setFacelable!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    // ps add ------8.11--------- calling setfacelable
+    LOG_ERROR <<"client : i want setFacelable!!!!!!!"<< LOG_ENDL;
     try
     {
 //        auto& waitScope = getRtspFaceViewClient()->getWaitScope();
@@ -694,12 +699,17 @@
 
         auto  request = rClient.setFaceLabelRequest();
         request.setCameraIndex(cameraIdx);
-        const capnp::Data::Builder &labelData = request.initLabel(wstr.size());
-        LOG_ERROR <<"ps ------------3"<< LOG_ENDL;
-        memcpy((char*)labelData.begin(), wstr.c_str(), wstr.size());
-        request.setLabel(labelData);
+        auto labelData = request.initLabel(wstr.size()*4);
+
+        char temp[100];char temp1[100];
+        memcpy(labelData.begin(), wstr.c_str(), wstr.size()*4);
+
+        memcpy(temp, labelData.begin(), wstr.size()*4);
+
+        memcpy(temp1, request.getLabel().begin(), wstr.size()*4);
         request.setTrackId(stTrackId);
-        LOG_ERROR <<"ps ------------2"<< LOG_ENDL;
+
+        const std::wstring &string = std::wstring((wchar_t*)labelData.begin());
         auto sendAct = request.send();
         sendAct.wait(waitScope);
     }
@@ -708,9 +718,8 @@
         std::cout << e.getDescription().cStr() << std::endl;
         return;
     }
-    LOG_ERROR <<"client : i want setFacelable   end!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
+    LOG_ERROR <<"client : i want setFacelable   end!!!!!!!!!!!!!!"<< LOG_ENDL;
 
     //-------end-------
-    //cameraWrapper.setFaceLabel(stTrackId, wstr);
 }
 } // extern C
diff --git a/VisitFace/RtspNativeCodec/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java b/VisitFace/RtspNativeCodec/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java
index c058faf..9974950 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java
+++ b/VisitFace/RtspNativeCodec/app/src/main/java/cn/com/basic/face/util/RtspFaceNative.java
@@ -99,14 +99,14 @@
 
         for (int i = 0; i < c; i++)
         {
-            Log.i("@@@", "cameraIdx=" + cameraIdx +
-                    ", i=" + i +
-                    ", st_track_id=" + faceImages.get(i).st_track_id+
-                    ", size=" + faceImages.get(i).size+
-                    ", w=" + faceImages.get(i).width +
-                    ", h=" + faceImages.get(i).height +
-                    ", image[0]=" + faceImages.get(i).image[0] +
-                    ", image[1]=" + faceImages.get(i).image[1]);
+//            Log.i("@@@", "cameraIdx=" + cameraIdx +
+//                    ", i=" + i +
+//                    ", st_track_id=" + faceImages.get(i).st_track_id+
+//                    ", size=" + faceImages.get(i).size+
+//                    ", w=" + faceImages.get(i).width +
+//                    ", h=" + faceImages.get(i).height );
+////                    ", image[0]=" + faceImages.get(i).image[0] +
+////                    ", image[1]=" + faceImages.get(i).image[1]);
 
             if (i == 0)
             {
@@ -115,10 +115,13 @@
                 //bitmap.copyPixelsFromBuffer(byteBuffer);
                 //NativeCodec.setFaceDrawable(bitmap);
 
-                NativeCodec.setFaceDrawable(faceImages.get(i));
+               // NativeCodec.setFaceDrawable(faceImages.get(i));
             }
+            setFaceLabel(cameraIdx+1, faceImages.get(i).st_track_id , "4444444edddddd");
         }
 
+        //#todo fix setFacelable
+
         releaseFace(cameraIdx);
     }
 
diff --git a/VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java b/VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java
index 9289265..d891430 100644
--- a/VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java
+++ b/VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java
@@ -21,7 +21,6 @@
 import android.graphics.PixelFormat;
 import android.graphics.SurfaceTexture;
 import android.graphics.drawable.Drawable;
-import android.media.MediaCodecInfo;
 import android.os.Bundle;
 import android.util.Log;
 import android.util.Xml;
@@ -54,8 +53,6 @@
 
 import cn.com.basic.face.util.NativeImg;
 import cn.com.basic.face.util.RtspFaceNative;
-
-import static java.lang.Thread.sleep;
 
 public class NativeCodec extends Activity {
     static final String TAG = "NativeCodec";
@@ -97,14 +94,13 @@
         //Runtime.getRuntime().exec(new String[]{"/system/bin/su","-c", cmd});
 
         RtspFaceNative.init();
-        //for (int i=0 ;i < 32; i+=2){
-        //    RtspFaceNative.setFaceLabel(1, i, "涓枃鍚嶅瓧");
-        //    RtspFaceNative.setFaceLabel(1, i+1, "abcd");
-        //    RtspFaceNative.setFaceLabel(2, i, "涓枃鍚嶅瓧");
-        //    RtspFaceNative.setFaceLabel(2, i+1, "abcd");
-        //}
 
-        RtspFaceNative.setLocalIP("192.168.1.93");
+
+        //server
+        //RtspFaceNative.setLocalIP("192.168.1.94");
+        //client
+        RtspFaceNative.setLocalIP("192.168.1.97");
+
 
         mGLView1 = (MyGLSurfaceView) findViewById(R.id.glsurfaceview1);
 
@@ -284,6 +280,8 @@
                         RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                         RtspFaceNative.setFaceCallback(2, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
 
+
+
                         //try
                         //{
                         //    String str = convertStreamToString(ThisActivity.getAssets().open("license.lic"));
@@ -297,14 +295,17 @@
                         //mCreated = createStreamingMediaPlayer(getResources().getAssets(), mSourceString);
                         //#todo ok
                         //mCreated = RtspFaceNative.createPlayer(1, "rtsp://admin:admin@192.168.1.188:554/cam/realmonitor?channel=1&subtype=2");
-                        //mCreated = RtspFaceNative.createPlayer(2, "rtsp://admin:admin12345@192.168.1.202:554/h264/ch1/main/av_stream");
+                        //mCreated = RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.202:554/h264/ch1/main/av_stream");
                         //mCreated = RtspFaceNative.createPlayer(2, "rtsp://Admin:1234@192.168.1.22/h264");
                         mCreated = RtspFaceNative.createPlayer(1, "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream");
-                        //mCreated = RtspFaceNative.createPlayer(1, "rtsp://192.168.1.94:8554");
+                         //mCreated = RtspFaceNative.createPlayer(1, "rtsp://192.168.1.112:8554/");
+                        //mCreated = createPlayer(1, "rtsp://192.168.1.56:8554");
 
                         //byte[] arr = new byte[5];
                         //arr[0] = 3; arr[1] = 4; arr[2] = 5;
                         //RtspFaceNative.getFaceList(1, arr);
+
+
                     }
                 }
                 if (mCreated) {
@@ -312,7 +313,9 @@
                     //setPlayingStreamingMediaPlayer(mIsPlaying);
                 }
             }
+
         });
+
 
         // native MediaPlayer rewind
         ((Button) findViewById(R.id.rewind_native)).setOnClickListener(new View.OnClickListener() {
@@ -492,8 +495,9 @@
 
     /** Load jni .so on initialization */
     static {
-        //System.loadLibrary("rtspface_client");
-        System.loadLibrary("rtspface_server");
+        //Select library
+        System.loadLibrary("rtspface_client");
+        //System.loadLibrary("rtspface_server");
         //System.loadLibrary("opencv_java3");
     }
 

--
Gitblit v1.8.0