ソースを参照

Z991239-5263 #comment 跨平台实现优化,删除多余依赖库

80274480 1 年間 前
コミット
769bb6f25a

+ 1 - 5
Module/mod_livenessdetection/CMakeLists.txt

@@ -6,10 +6,6 @@ endif(MSVC)
 
 if(MSVC)
     set(WIN_SRC 
-	LivenessDetectionFSM.h
-	LivenessDetectionFSM.cpp
-	YituLiveSDK.h
-	YituLiveSDK.cpp
 	stdafx.h
 	stdafx.cpp)
 else()
@@ -19,7 +15,7 @@ endif(MSVC)
 set(${MODULE_PREFIX}_SRCS
 	Event.h
 	mod_livenessdetection.h
-	${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_PLAFORM_SUBDIR}/mod_livenessdetection.cpp
+	mod_livenessdetection.cpp
 	RvcFaceVideo.cpp
 	RvcFaceVideo.h
 	RvcWsServer.cpp

+ 0 - 80
Module/mod_livenessdetection/LivenessDetection.xml

@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="gb2312" ?>
-<entity name="LivenessDetection">	
-	<!-- 活体检测服务 -->
-	<class name="LivenessDetectionService" overlap="true"  exclusive="false">
-		<!-- 启动检测接口 -->
-		<twoway name="StartLivenessDetection" overlap="true">
-			<req>
-				<!-- 活体检测ActionID 16位 -->
-				<param name="ActionID" type="wstring"/>
-				<!-- 是否为主动检测(默认false,被动) -->
-				<param name="IsActive" type="bool"/>
-				<!-- 保留参数 -->
-				<param name="Reserved" type="wstring"/>
-			</req>
-			<res>
-			</res>
-		</twoway>
-		<!-- 停止检测接口(被动检测用到返回结果) -->
-		<twoway name="StopLivenessDetection" overlap="true">
-			<req>
-				<!-- 活体检测ActionID 16位 -->
-				<param name="ActionID" type="wstring"/>
-			</req>
-			<res>
-				<!-- 活体检测ActionID 16位 -->
-				<param name="ActionID" type="wstring"/>
-				<!-- 活体判别结果 Y(活体) N(非活体) X(不确定) -->
-				<param name="VerifyResult" type="wstring"/>
-				<!-- 活体照片数据(可能多张) -->
-				<param name="LivePhotosData" type="blob"/>
-				<!-- 活体照片长度列表,以'|'分隔 -->
-				<param name="LivePhotosLength" type="wstring"/>
-			</res>
-		</twoway>
-	</class>
-	<!-- 主动检测完成消息 -->
-	<message name="ActiveDetectionDone">
-		<!-- 活体检测ActionID 16位 -->
-		<param name="ActionID" type="wstring"/>
-		<!-- 主动活体判别结果 Y(活体) N(非活体) X(不确定) -->
-		<param name="VerifyResult" type="wstring"/>
-		<!-- 自动抓拍照片数据 -->
-		<param name="SnapShotPhotoData" type="blob"/>
-		<!-- 自动抓拍照片长度 -->
-		<param name="SnapShotPhotoLength" type="int"/>
-	</message>	
-	<!-- 自动抓拍提示消息 -->
-	<message name="AutoSnapshotRemind">
-		<!-- 活体检测ActionID 16位 -->
-		<param name="ActionID" type="wstring"/>
-		<!-- 提示信息 -->
-		<param name="RemindInfo" type="wstring"/>
-	</message>	
-	<!-- 检测非正常结束消息 -->
-	<message name="DetectionStopUnExpected">
-		<!-- 活体检测ActionID 16位 -->
-		<param name="ActionID" type="wstring"/>
-		<!-- 是否为主动检测(默认false,被动) -->
-		<param name="IsActive" type="bool"/>
-		<!-- 错误码 -->
-		<param name="ErrorCode" type="wstring"/>
-		<!-- 错误消息:超时、启动检测失败... -->
-		<param name="ErrorMsg" type="wstring"/>
-	</message>
-	<!-- 活体检测心跳消息(可选) -->
-	<message name="LivenessDetectionHeartBeat">
-		<!-- 状态:0:正常 1:故障... -->
-		<param name="Status" type="int"/>
-	</message>	
-	<!-- 主动活体启动消息 -->
-	<message name="ActiveDetectionStarted">
-		<!-- 启动参数(回显窗口用) -->
-		<param name="Param" type="string"/>
-	</message>	
-	<!-- 主动活体停止消息 -->
-	<message name="ActiveDetectionStopped">
-		<!-- 停止参数(回显窗口用) -->
-		<param name="Param" type="string"/>
-	</message>	
-</entity>

+ 0 - 179
Module/mod_livenessdetection/LivenessDetection_client_g.h

@@ -1,179 +0,0 @@
-
-#ifndef __LIVENESSDETECTION_CLIENT_G_H
-#define __LIVENESSDETECTION_CLIENT_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "LivenessDetection_def_g.h"
-
-namespace LivenessDetection {
-class LivenessDetectionService_ClientBase : public CClientSessionBase {
-public:
-	explicit LivenessDetectionService_ClientBase(CEntityBase *pEntity) : m_pEntityBase(pEntity), m_bSysManaged(false) {}
-
-	LivenessDetectionService_ClientBase* operator () (const linkContext &curLink) 
-	{
-		m_context = curLink;
-		return this;
-	}
-
-protected:
-	virtual ~LivenessDetectionService_ClientBase()
-	{
-		/// override by user
-	}
-public:
-
-	void OnConnectSucceed()
-	{
-		bSessionClosed = false;
-	}
-	void OnClose(ErrorCodeEnum)
-	{
-		Dbg("session closed.");
-		bSessionClosed = true;
-	}
-	bool QuerySessionClosed()
-	{
-		return bSessionClosed;
-	}
-	ErrorCodeEnum Connect(CSmartPointer<IAsynWaitSp> &spAsyncWait)
-	{
-		CSmartPointer<IEntityFunction> pFunc = m_pEntityBase->GetFunction();
-		ErrorCodeEnum Error = pFunc->ConnectRemoteEntity(this, "LivenessDetection", "LivenessDetectionService", spAsyncWait);
-		if (Error == Error_Succeed) {
-			m_bSysManaged = true;
-			bSessionClosed = false;
-		}
-		return Error;
-	}
-	ErrorCodeEnum Connect()
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = Connect(spAsyncWait);
-		if (Error == Error_Succeed) {
-			Error = spAsyncWait->WaitAnswer();
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(LivenessDetectionService_Method_StartLivenessDetection, LivenessDetectionService_MethodSignature_StartLivenessDetection, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum StartLivenessDetection(LivenessDetectionService_StartLivenessDetection_Req &Req, LivenessDetectionService_StartLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StartLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-	ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, CSmartPointer<IAsynWaitSp> &spAsyncWait, DWORD dwTimeout)
-	{
-		CSmartPointer<IClientSessionFunction> pFunc = GetFunction();
-		CAutoBuffer Buf = SpObject2Buffer(Req);
-		if (m_context.checkEmpty())
-		{
-			m_context.AutoGenerate();
-			DbgToBeidou(m_context, m_pEntityBase != NULL ? m_pEntityBase->GetEntityName() : "")();
-			m_context = m_context.upgradeLink();
-		}
-		auto ret = pFunc->AsyncRequest(LivenessDetectionService_Method_StopLivenessDetection, LivenessDetectionService_MethodSignature_StopLivenessDetection, Buf, spAsyncWait, m_context, dwTimeout);
-		m_context.clear();
-		return ret;
-	}
-	ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError, CSimpleString &str)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-	ErrorCodeEnum StopLivenessDetection(LivenessDetectionService_StopLivenessDetection_Req &Req, LivenessDetectionService_StopLivenessDetection_Ans &Ans, DWORD dwTimeout, DWORD &dwUserError)
-	{
-		CSmartPointer<IAsynWaitSp> spAsyncWait;
-		ErrorCodeEnum Error = StopLivenessDetection(Req, spAsyncWait, dwTimeout);
-		if (Error == Error_Succeed) {
-			bool bEnd = false;
-			CSimpleString str;
-			Error = SpWaitAnswerObject(spAsyncWait, Ans, bEnd, dwUserError, str, dwTimeout);
-			LOG_ASSERT(Error || bEnd);
-		}
-		return Error;
-	}
-
-
-	bool SafeDelete()
-	{
-		if (!m_bSysManaged) {
-			delete this;
-		}
-		return m_bSysManaged;
-	}
-
-protected:
-	bool m_bSysManaged;
-	CEntityBase *m_pEntityBase;
-	linkContext m_context;
-	bool bSessionClosed;
-};
-
-///////////////////////////
-
-} // namespace LivenessDetection
-#endif // __LIVENESSDETECTION_CLIENT_G_H

+ 0 - 76
Module/mod_livenessdetection/LivenessDetection_def_g.h

@@ -1,76 +0,0 @@
-#ifndef __LIVENESSDETECTION_DEF_G_H
-#define __LIVENESSDETECTION_DEF_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "SpHelper.h"
-
-namespace LivenessDetection {
-//
-// const goes here
-//
-
-#define LivenessDetectionService_Method_StartLivenessDetection 0
-#define LivenessDetectionService_Method_StopLivenessDetection 1
-
-#define LivenessDetectionService_MethodSignature_StartLivenessDetection 1875899628
-#define LivenessDetectionService_MethodSignature_StopLivenessDetection -698442534
-
-#define LivenessDetectionService_LogCode_StartLivenessDetection "QLR040231400"
-#define LivenessDetectionService_LogCode_StopLivenessDetection "QLR040231401"
-
-struct LivenessDetectionService_StartLivenessDetection_Req
-{
-	CSimpleStringW ActionID;
-	bool IsActive;
-	CSimpleStringW Reserved;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID & IsActive & Reserved;
-	}
-
-};
-
-struct LivenessDetectionService_StartLivenessDetection_Ans
-{
-
-	void Serialize(SpBuffer &Buf)
-	{
-	}
-
-};
-
-struct LivenessDetectionService_StopLivenessDetection_Req
-{
-	CSimpleStringW ActionID;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID;
-	}
-
-};
-
-struct LivenessDetectionService_StopLivenessDetection_Ans
-{
-	CSimpleStringW ActionID;
-	CSimpleStringW VerifyResult;
-	CBlob LivePhotosData;
-	CSimpleStringW LivePhotosLength;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID & VerifyResult & LivePhotosData & LivePhotosLength;
-	}
-
-};
-
-
-///////////////////////////
-
-} // namespace LivenessDetection
-
-#endif // __LIVENESSDETECTION_DEF_G_H

+ 0 - 112
Module/mod_livenessdetection/LivenessDetection_msg_g.h

@@ -1,112 +0,0 @@
-
-#ifndef __LIVENESSDETECTION_MSG_G_H
-#define __LIVENESSDETECTION_MSG_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "SpHelper.h"
-
-namespace LivenessDetection {
-#define eMsg_ActiveDetectionDone 0
-#define eMsg_AutoSnapshotRemind 1
-#define eMsg_DetectionStopUnExpected 2
-#define eMsg_LivenessDetectionHeartBeat 3
-#define eMsg_ActiveDetectionStarted 4
-#define eMsg_ActiveDetectionStopped 5
-
-#define eMsgSig_ActiveDetectionDone 1663036101
-#define eMsgSig_AutoSnapshotRemind -1204333518
-#define eMsgSig_DetectionStopUnExpected 135483694
-#define eMsgSig_LivenessDetectionHeartBeat -835179092
-#define eMsgSig_ActiveDetectionStarted -390712849
-#define eMsgSig_ActiveDetectionStopped 576206235
-
-struct ActiveDetectionDone
-{
-	CSimpleStringW ActionID;
-	CSimpleStringW VerifyResult;
-	CBlob SnapShotPhotoData;
-	int SnapShotPhotoLength;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID & VerifyResult & SnapShotPhotoData & SnapShotPhotoLength;
-	}
-
-};
-
-///////////////////////////
-
-struct AutoSnapshotRemind
-{
-	CSimpleStringW ActionID;
-	CSimpleStringW RemindInfo;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID & RemindInfo;
-	}
-
-};
-
-///////////////////////////
-
-struct DetectionStopUnExpected
-{
-	CSimpleStringW ActionID;
-	bool IsActive;
-	CSimpleStringW ErrorCode;
-	CSimpleStringW ErrorMsg;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & ActionID & IsActive & ErrorCode & ErrorMsg;
-	}
-
-};
-
-///////////////////////////
-
-struct LivenessDetectionHeartBeat
-{
-	int Status;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & Status;
-	}
-
-};
-
-///////////////////////////
-
-struct ActiveDetectionStarted
-{
-	CSimpleStringA Param;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & Param;
-	}
-
-};
-
-///////////////////////////
-
-struct ActiveDetectionStopped
-{
-	CSimpleStringA Param;
-
-	void Serialize(SpBuffer &Buf)
-	{
-		auto & buf = Buf & Param;
-	}
-
-};
-
-///////////////////////////
-
-} // namespace LivenessDetection
-#endif // __LIVENESSDETECTION_MSG_G_H

+ 0 - 137
Module/mod_livenessdetection/LivenessDetection_server_g.h

@@ -1,137 +0,0 @@
-
-#ifndef __LIVENESSDETECTION_SERVER_G_H
-#define __LIVENESSDETECTION_SERVER_G_H
-
-#pragma once
-
-// This code is generated by spgen tool!
-
-#include "LivenessDetection_def_g.h"
-
-namespace LivenessDetection {
-class LivenessDetectionService_ServerSessionBase : public CServerSessionBase
-{
-public:
-	LivenessDetectionService_ServerSessionBase()
-	{
-		/// override by user
-	}
-
-	virtual ~LivenessDetectionService_ServerSessionBase()
-	{
-		/// override by user
-	}
-
-	virtual bool IsExclusive() { return false; }
-
-	virtual bool IsSessionOverlap() { return true; }
-
-	virtual ErrorCodeEnum GetMessageAttr(DWORD dwMessageID, DWORD dwSignature, bool &bOverlap)
-	{
-		ErrorCodeEnum Error = Error_Succeed;
-		switch (dwMessageID) {
-		case LivenessDetectionService_Method_StartLivenessDetection:
-			if (dwSignature == LivenessDetectionService_MethodSignature_StartLivenessDetection) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case LivenessDetectionService_Method_StopLivenessDetection:
-			if (dwSignature == LivenessDetectionService_MethodSignature_StopLivenessDetection) {
-				bOverlap = true;
-			} else {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		default:
-			Error = Error_MethodNotFound;
-			break;
-		}
-		return Error;
-	}
-
-	int CheckMessageSignature(DWORD dwMessageID, DWORD dwSignature)
-	{
-		ErrorCodeEnum Error = Error_Succeed;
-		switch (dwMessageID) {
-		case LivenessDetectionService_Method_StartLivenessDetection:
-			if (dwSignature != LivenessDetectionService_MethodSignature_StartLivenessDetection) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		case LivenessDetectionService_Method_StopLivenessDetection:
-			if (dwSignature != LivenessDetectionService_MethodSignature_StopLivenessDetection) {
-				Error = Error_MethodSignatureFailed;
-			}
-			break;
-		default:
-			Error = Error_MethodNotFound;
-			break;
-		}
-		return Error;
-	}
-
-	virtual void Handle_StartLivenessDetection(SpReqAnsContext<LivenessDetectionService_StartLivenessDetection_Req, LivenessDetectionService_StartLivenessDetection_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void Handle_StopLivenessDetection(SpReqAnsContext<LivenessDetectionService_StopLivenessDetection_Req, LivenessDetectionService_StopLivenessDetection_Ans>::Pointer ctx)
-	{
-	/// override by user
-	}
-
-	virtual void OnRequest(CSmartPointer<ITransactionContext> pTransactionContext)
-	{
-		CAutoBuffer Buf;
-		DWORD dwMessageID;
-		DWORD dwMessageSignature;
-		ErrorCodeEnum Error = pTransactionContext->GetReceiveBuffer(dwMessageID, dwMessageSignature, Buf);
-		if (Error == Error_Succeed) {
-#ifdef DEBUG
-			assert(CheckMessageSignature(dwMessageID, dwMessageSignature) == Error_Succeed);
-#else
-			if (CheckMessageSignature(dwMessageID, dwMessageSignature) != Error_Succeed) {
-				pTransactionContext->SendAnswer(Error_MethodSignatureFailed);
-				return;
-			}
-#endif
-			switch (dwMessageID) {
-				case LivenessDetectionService_Method_StartLivenessDetection:
-					{
-						SpReqAnsContext<LivenessDetectionService_StartLivenessDetection_Req,LivenessDetectionService_StartLivenessDetection_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<LivenessDetectionService_StartLivenessDetection_Req,LivenessDetectionService_StartLivenessDetection_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StartLivenessDetection(ctx);
-					}
-					break;
-				case LivenessDetectionService_Method_StopLivenessDetection:
-					{
-						SpReqAnsContext<LivenessDetectionService_StopLivenessDetection_Req,LivenessDetectionService_StopLivenessDetection_Ans>::Pointer ctx;
-						ctx.Attach(new SpReqAnsContext<LivenessDetectionService_StopLivenessDetection_Req,LivenessDetectionService_StopLivenessDetection_Ans>(pTransactionContext));
-						SpBuffer2Object(Buf, ctx->Req);
-						pTransactionContext->GetLinkContext(ctx->link);
-						EntityResource::setLink(ctx->link);
-						Handle_StopLivenessDetection(ctx);
-					}
-					break;
-				default:
-					assert(0);
-					break;
-			}
-			
-		} else {
-			pTransactionContext->SendAnswer(Error);
-		}
-	}
-
-};
-
-
-///////////////////////////
-
-} // namespace LivenessDetection
-#endif // __LIVENESSDETECTION_SERVER_G_H

+ 4 - 4
Module/mod_livenessdetection/RvcFaceVideo.cpp

@@ -172,11 +172,11 @@ int RvcFaceVideo::GetPreViewVideoFrameSize(int icameraid, int* ivideowidth, int*
 }
 
 
-BOOL RvcFaceVideo::GetVideoFrame(int icameraid, videoq_frame* videoframe, int iflags)
+bool RvcFaceVideo::GetVideoFrame(int icameraid, videoq_frame* videoframe, int iflags)
 {
 	assert(icameraid == 0 || icameraid == 1);
 
-	BOOL bRslt = FALSE;
+	bool bRslt = false;
 	if (icameraid == 0){	
 		bRslt = m_env_videoqueue->GetVideo(videoframe, iflags);
 	}
@@ -189,11 +189,11 @@ BOOL RvcFaceVideo::GetVideoFrame(int icameraid, videoq_frame* videoframe, int if
 }
 
 
-BOOL RvcFaceVideo::GetPreViewVideoFrame(int icameraid, videoq_frame* videoframe, int iflags)
+bool RvcFaceVideo::GetPreViewVideoFrame(int icameraid, videoq_frame* videoframe, int iflags)
 {
 	assert(icameraid == 0 || icameraid == 1);
 
-	BOOL bRslt = FALSE;
+	bool bRslt = false;
 	if (icameraid == 0){	
 		bRslt = m_preview_env_videoqueue->GetVideo(videoframe, iflags);
 	}

+ 2 - 2
Module/mod_livenessdetection/RvcFaceVideo.h

@@ -16,8 +16,8 @@ public:
 	int InitVideoQueue(const char* strenvqueue, const char* stroptqueue, const char* strpreview_envqueue, const char* strpreview_optqueue);
 	int GetVideoFrameSize(int icameraid, int* ivideowidth, int* ivideoheight);
 	int GetPreViewVideoFrameSize(int icameraid, int* ivideowidth, int* ivideoheight);
-	BOOL GetVideoFrame(int icameraid, videoq_frame* videoframe, int iflags);
-	BOOL GetPreViewVideoFrame(int icameraid, videoq_frame* videoframe, int iflags);
+	bool GetVideoFrame(int icameraid, videoq_frame* videoframe, int iflags);
+	bool GetPreViewVideoFrame(int icameraid, videoq_frame* videoframe, int iflags);
 	int InitVideoFrame();
 
 public:

+ 126 - 101
Module/mod_livenessdetection/win/mod_livenessdetection.cpp → Module/mod_livenessdetection/mod_livenessdetection.cpp

@@ -1,23 +1,65 @@
+#ifdef RVC_OS_WIN
 #include "stdafx.h"
-#include <stdint.h>
+#endif // RVC_OS_WIN
 #include "mod_livenessdetection.h"
-#include "videoframework.h"
+#include "../mod_interactivecontrol/Event.h"
 
 //compile with VS2019 bcz jpeg.lib is compiled from VS2010 which lower version.
-#if defined(RVC_OS_WIN)
+#ifdef RVC_OS_WIN
 #pragma comment(lib, "legacy_stdio_definitions.lib")
 extern "C" {
 	FILE __iob_func[3] = { *stdin, *stdout, *stderr };
 }
 #endif //RVC_OS_WIN
 
-CLivenessDetectionEntity::CLivenessDetectionEntity(): m_bStarted(FALSE), m_nCaptureType(-1)/*, m_pFsm(NULL), m_pCapturer(NULL)*/
+
+static int __on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize, void* user_data)
+{
+	CLivenessDetectionEntity* pThis = static_cast<CLivenessDetectionEntity*>(user_data);
+
+	int iret = pThis->on_get_videodata(eType, ecameraid, width, height, bmpdata, isize);
+
+	return iret;
+}
+
+
+#ifdef RVC_OS_WIN
+static unsigned int __stdcall start_wsserver(void *arg)
+#else
+static void* start_wsserver(void* arg)
+#endif                                                
+{
+	CLivenessDetectionEntity* liveness_entity = (CLivenessDetectionEntity*)arg;
+
+	websocket_callback_t t_callback = {0};
+	t_callback.user_data = liveness_entity;
+	t_callback.on_get_videodata = &__on_get_videodata;
+	rvc_video_param_t t_param = {0};
+	t_param.iwidth = REC_COMMON_VIDEO_PREVIEW_WIDTH;
+	t_param.iheight = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
+	t_param.icapwidth = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
+	t_param.icapheight = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
+	int iRet = liveness_entity->GetWsServer()->Init_WsServer(&t_callback, &t_param, liveness_entity->GetWsPort());
+
+#ifdef RVC_OS_WIN
+	return 0;
+#else
+	return &iRet;
+#endif  
+}
+
+
+CLivenessDetectionEntity::CLivenessDetectionEntity()
 {
 	m_WsServer = new RvcWsServer();
 	m_pFaceVideo = new RvcFaceVideo();
-	m_hWsServerThread = NULL;
 	m_iWsPort = RVC_LIVENESS_WS_PORT;
-	m_iCapType = 1;
+
+#ifdef RVC_OS_WIN
+	m_hWsServerThread = NULL;
+#else
+	m_hWsServerThreadId = 0;
+#endif
 }
 
 CLivenessDetectionEntity::~CLivenessDetectionEntity()
@@ -27,6 +69,7 @@ CLivenessDetectionEntity::~CLivenessDetectionEntity()
 		m_WsServer = NULL;
 	}
 
+#ifdef RVC_OS_WIN
 	if (m_pFaceVideo){
 		delete m_pFaceVideo;
 		m_pFaceVideo = NULL;
@@ -38,7 +81,16 @@ CLivenessDetectionEntity::~CLivenessDetectionEntity()
 		TerminateThread(m_hWsServerThread, exitCode);
 		m_hWsServerThread = NULL;
 	}
-
+	
+#else
+	pthread_cancel(m_hWsServerThreadId);
+	if (0 == pthread_join(m_hWsServerThreadId, NULL)) {
+		m_hWsServerThreadId = 0;
+	}
+	else {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("thread join web socket server thread failed!");
+	}
+#endif		
 }
 
 const char * CLivenessDetectionEntity::GetEntityName() const
@@ -53,43 +105,22 @@ void CLivenessDetectionEntity::OnPreStart( CAutoArray<CSimpleStringA> strArgs,CS
 }
 
 
-static int __on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize, void* user_data)
-{
-	CLivenessDetectionEntity *pThis = static_cast<CLivenessDetectionEntity *>(user_data);
-
-	int iret = pThis->on_get_videodata(eType, ecameraid, width, height, bmpdata, isize);
-
-	return iret;
-}
-
-                                                                 
-static unsigned int __stdcall start_wsserver(void *arg)
-{
-	CLivenessDetectionEntity *liveness_entity = (CLivenessDetectionEntity *)arg;
-
-	websocket_callback_t t_callback = {0};
-	t_callback.user_data = liveness_entity;
-	t_callback.on_get_videodata = &__on_get_videodata;
-	rvc_video_param_t t_param = {0};
-	t_param.iwidth = REC_COMMON_VIDEO_PREVIEW_WIDTH;
-	t_param.iheight = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
-	t_param.icapwidth = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
-	t_param.icapheight = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
-	liveness_entity->GetWsServer()->Init_WsServer(&t_callback, &t_param, liveness_entity->GetWsPort());
-
-	return 0;
-}
-
 void CLivenessDetectionEntity::OnStarted()
 {
 	if (Error_Succeed != GetEntityConfigure()){
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[LivenessDetectionFSM] Get Entity Configure Failed!");
 	}
 
+#ifdef RVC_OS_WIN
 	m_hWsServerThread = (HANDLE)_beginthreadex(NULL, 0, &start_wsserver, this, 0, NULL);
-	if (NULL != m_hWsServerThread){
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create web socket server success.");
+	if (NULL == m_hWsServerThread){
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create web socket server thread failed.");
+	}
+#else
+	if (0 != pthread_create(&m_hWsServerThreadId, NULL, start_wsserver, (void*)this)) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create web socket server thread failed.");
 	}
+#endif	
 }
 
 
@@ -111,68 +142,50 @@ ErrorCodeEnum CLivenessDetectionEntity::__OnStart(ErrorCodeEnum preOperationErro
 	CSmartPointer<IEntityFunction> spFunction = GetFunction();
 	CSystemStaticInfo stStaticinfo;
 	spFunction->GetSystemStaticInfo(stStaticinfo);
-	if (stricmp(stStaticinfo.strMachineType,"RVC.PAD")==0)
-	{		
-		if (stricmp(stStaticinfo.strSite,"CMB.FLB")==0)
-		{
+	if (stricmp(stStaticinfo.strMachineType,"RVC.PAD")==0){		
+		if (stricmp(stStaticinfo.strSite,"CMB.FLB")==0){
 			m_eDeviceType = eMobilePadType;
 		}
 	}
-	else if (stricmp(stStaticinfo.strMachineType,"RPM.Stand1S")==0) 
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is rpm.stand1s");
-		m_eDeviceType = eRpm1sType;
-	}
-	else if (stricmp(stStaticinfo.strMachineType,"RVC.Desk2S")==0)
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is Desk2S");
-		m_eDeviceType = eDesk2SType;
+	else if (stricmp(stStaticinfo.strMachineType,"RPM.Stand1SPlus")==0) {
+		m_eDeviceType = eStand1SPlusType;
 	}
-	else
-	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is standard");
+	else{
 		m_eDeviceType = eStand2sType;
 	}
 
-	if (preOperationError != Error_Succeed)
-		return preOperationError;
+	if (m_eDeviceType >= 0 && m_eDeviceType < sizeof(Device_Type_Table) / sizeof(char*)) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("device type is %s.", Device_Type_Table[m_eDeviceType]);
+	}
 
 	ErrorCodeEnum Error = Error_Succeed;
 	nActiveCamera = CAMERA_TYPE_ENV;
 	m_iCameraState = 'N';
-	BOOL bRet = FALSE;
 	
-	if (ePadtype==m_eDeviceType||eMobilePadType==m_eDeviceType||eDesk2SType==m_eDeviceType){
-		m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, NULL, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, NULL);
-	}
-	else{
-		m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
-	}
+#ifdef RVC_OS_WIN
+	InitVideoQueueInfo();
+#endif
 
 	int i = 0;
 	m_arrListener.Init(2);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_BEGIN_RECORD, NULL, false);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, EVENT_MOD_END_RECORD, NULL, false);
+	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED, NULL, false);
+	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED, NULL, false);
 	
 	GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA, this);
 	GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE, this);
 	CSimpleStringA strValue;
 	GetFunction()->GetSysVar(SYSVAR_CAMERASTATE, strValue);
 	m_iCameraState = strValue[0];
-	if (strValue[0] == 'E')
-	{
+	if (strValue[0] == 'E'){
 		nActiveCamera = CAMERA_TYPE_OPT;
 	}
-	else if (strValue[0] == 'O')
-	{
+	else if (strValue[0] == 'O'){
 		nActiveCamera = CAMERA_TYPE_ENV;
 	}
-	else if(strValue[0] == 'B')   ///////显示贴图
-	{
+	else if(strValue[0] == 'B') {
 		nActiveCamera = CAMERA_TYPE_ERROR;
 	}
-	else if (strValue[0] == 'N')
-	{
+	else if (strValue[0] == 'N'){
 		nActiveCamera = CAMERA_TYPE_ENV;
 	}
 
@@ -181,38 +194,18 @@ ErrorCodeEnum CLivenessDetectionEntity::__OnStart(ErrorCodeEnum preOperationErro
 
 ErrorCodeEnum CLivenessDetectionEntity::__OnClose( ErrorCodeEnum preOperationError )
 {
-	if (preOperationError != Error_Succeed)
+	if (preOperationError != Error_Succeed) {
 		return preOperationError;
-
+	}
+		
 	CSmartPointer<IEntityFunction> spFunction = GetFunction();
-	for (int i = 0; i < m_arrListener.GetCount(); ++i)
-	{
+	for (int i = 0; i < m_arrListener.GetCount(); ++i){
 		spFunction->UnsubscribeLog(m_arrListener[i]);
 	}
 
 	return Error_Succeed;
 }
 
-void CLivenessDetectionEntity::Debug( const char *fmt, ... )
-{
-	va_list arg;
-	va_start(arg, fmt);
-
-	int n = _vscprintf(fmt, arg);
-	if (n >= 512) {
-		char* buf = (char*)malloc((size_t)(n + 1));
-		_vsnprintf(buf, n + 1, fmt, arg);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
-		free(buf);
-	}
-	else{
-		char strlog[512] = {0};
-		_vsnprintf(strlog, 512, fmt, arg);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
-	}
-	va_end(arg);
-}
-
 int CLivenessDetectionEntity::GetActiveCamera()
 {
 	return nActiveCamera;
@@ -220,7 +213,23 @@ int CLivenessDetectionEntity::GetActiveCamera()
 
 void CLivenessDetectionEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel, const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext &pLinkInfo)
 {
-	
+	switch (dwUserCode) 
+	{
+#ifdef RVC_OS_LINUX
+	case LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED:
+		InitVideoQueueInfo();
+		break;
+
+	case LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED:
+		if (m_pFaceVideo){
+			delete m_pFaceVideo;
+			m_pFaceVideo = NULL;
+		}
+		break;
+#endif
+	default:
+		break;
+	}
 }
 
 void CLivenessDetectionEntity::OnSysVarEvent( const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName )
@@ -270,6 +279,19 @@ void CLivenessDetectionEntity::OnSelfTest( EntityTestEnum eTestType,CSmartPointe
 }
 
 
+void CLivenessDetectionEntity::InitVideoQueueInfo()
+{
+	if (!m_pFaceVideo) {
+		m_pFaceVideo = new RvcFaceVideo();
+	}
+	if (eStand1SPlusType == m_eDeviceType || eMobilePadType == m_eDeviceType) {
+		m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, NULL, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, NULL);
+	}
+	else {
+		m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
+	}
+}
+
 
 int CLivenessDetectionEntity::on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize)
 {
@@ -297,19 +319,23 @@ int CLivenessDetectionEntity::on_get_videodata(eVideoType eType, eCameraType eca
 		qvframe.width = *width;
 		qvframe.height = *height;
 		qvframe.data = bmpdata;
-		BOOL bRet = FALSE;
+		bool bRet = false;
 		if (ePreview_Type == eType){
 			int iPreviewflag = 3;
-			if (eCamera_Env == ecameraid && 1 == m_iCapType){
+		#ifdef RVC_OS_WIN
+			if (eCamera_Env == ecameraid){
 				iPreviewflag = 1;
 			}
+		#endif
 			bRet = m_pFaceVideo->GetPreViewVideoFrame((int)ecameraid, &qvframe, iPreviewflag);
 		}
 		else{
 			int iCapflag = 2;
-			if (eCamera_Env == ecameraid && 1 == m_iCapType){
+		#ifdef RVC_OS_WIN
+			if (eCamera_Env == ecameraid){
 				iCapflag = 0;
 			}
+		#endif
 			bRet = m_pFaceVideo->GetVideoFrame((int)ecameraid, &qvframe, iCapflag);
 		}
 			
@@ -324,7 +350,6 @@ int CLivenessDetectionEntity::on_get_videodata(eVideoType eType, eCameraType eca
 	return idatalen;
 }
 
-
 ErrorCodeEnum CLivenessDetectionEntity::GetEntityConfigure()
 {
 	CSmartPointer<IConfigInfo> spConfig;
@@ -344,5 +369,5 @@ ErrorCodeEnum CLivenessDetectionEntity::GetEntityConfigure()
 
 
 SP_BEGIN_ENTITY_MAP()
-SP_ENTITY(CLivenessDetectionEntity)
+	SP_ENTITY(CLivenessDetectionEntity)
 SP_END_ENTITY_MAP()

+ 3 - 31
Module/mod_livenessdetection/mod_livenessdetection.h

@@ -13,10 +13,6 @@
 #include "mod_mediacontroller/Event.h"
 #include "mod_facetracking/sysvar.h"
 
-#include "LivenessDetection_def_g.h"
-#include "LivenessDetection_msg_g.h"
-#include "LivenessDetection_server_g.h"
-
 #include <assert.h>
 #include "EventCode.h"
 
@@ -26,18 +22,6 @@
 
 using namespace LivenessDetection;
 
-class CLivenessDetectionEntity;
-
-class LivenessDetectionServerSession : public LivenessDetectionService_ServerSessionBase
-{
-public:
-	LivenessDetectionServerSession(CLivenessDetectionEntity* pEntity) : m_pEntity(pEntity) {}
-	virtual ~LivenessDetectionServerSession() {}
-	
-private:
-	CLivenessDetectionEntity* m_pEntity;
-};
-
 class CLivenessDetectionEntity : public CEntityBase, public ILogListener, public ISysVarListener
 {
 public:
@@ -50,11 +34,6 @@ public:
 
 	virtual void OnStarted();
 
-#if defined(RVC_OS_WIN)
-	// CAviHostAPI
-	virtual void Debug(const char* fmt, ...);
-#endif //RVC_OS_WIN
-
 	virtual int GetActiveCamera();
 
 	ErrorCodeEnum __OnStart(ErrorCodeEnum preOperationError);
@@ -68,12 +47,6 @@ public:
 	virtual bool IsService() const { return true; }
 	virtual bool IsMultiThread() const { return false; }
 
-	// 实体服务化
-	virtual CServerSessionBase* OnNewSession(const char*, const char*)
-	{
-		return new LivenessDetectionServerSession(this);
-	}
-
 	DeviceTypeEnum GetDeviceType() const { return m_eDeviceType; }
 
 	int on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize);
@@ -90,24 +63,23 @@ private:
 
 	virtual void OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext);
 
+	void InitVideoQueueInfo();
+
 	DeviceTypeEnum m_eDeviceType;
 	int nActiveCamera;
 	int m_iCameraState;
 
 	CAutoArray<CUUID> m_arrListener;
-	BOOL m_bStarted;
 
-	int m_nCaptureType;
 	RvcWsServer* m_WsServer;
 	RvcFaceVideo* m_pFaceVideo;
 	 
-#if defined(RVC_OS_WIN)
+#ifdef RVC_OS_WIN
 	HANDLE m_hWsServerThread;
 #else
 	pthread_t m_hWsServerThreadId;
 #endif //RVC_OS_WIN
 	int m_iWsPort;
-	int m_iCapType;
 };
 
 #endif

+ 0 - 311
Module/mod_livenessdetection/unix/mod_livenessdetection.cpp

@@ -1,311 +0,0 @@
-#ifdef RVC_OS_WIN
-#include "stdafx.h"
-#endif // RVC_OS_WIN
-#include "mod_livenessdetection.h"
-#include "../mod_interactivecontrol/Event.h"
-
-
-static int __on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize, void* user_data)
-{
-	CLivenessDetectionEntity* pThis = static_cast<CLivenessDetectionEntity*>(user_data);
-
-	int iret = pThis->on_get_videodata(eType, ecameraid, width, height, bmpdata, isize);
-
-	return iret;
-}
-
-static void* start_wsserver(void* arg)
-{
-	CLivenessDetectionEntity* liveness_entity = (CLivenessDetectionEntity*)arg;
-
-	websocket_callback_t t_callback = { 0 };
-	t_callback.user_data = liveness_entity;
-	t_callback.on_get_videodata = &__on_get_videodata;
-	rvc_video_param_t t_param = { 0 };
-	t_param.iwidth = REC_COMMON_VIDEO_PREVIEW_WIDTH;
-	t_param.iheight = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
-	t_param.icapwidth = REC_COMMON_VIDEO_SNAPSHOT_WIDTH;
-	t_param.icapheight = REC_COMMON_VIDEO_SNAPSHOT_HEIGHT;
-	int iRet = liveness_entity->GetWsServer()->Init_WsServer(&t_callback, &t_param, liveness_entity->GetWsPort());
-
-	return &iRet;
-}
-
-
-CLivenessDetectionEntity::CLivenessDetectionEntity(): m_bStarted(FALSE), m_nCaptureType(-1)
-{
-	m_WsServer = new RvcWsServer();
-	m_pFaceVideo = new RvcFaceVideo();
-	m_hWsServerThreadId = 0;
-	m_iWsPort = RVC_LIVENESS_WS_PORT;
-	m_iCapType = 1;
-}
-
-CLivenessDetectionEntity::~CLivenessDetectionEntity()
-{
-	if (m_WsServer) {
-		delete m_WsServer;
-		m_WsServer = NULL;
-	}
-
-	pthread_cancel(m_hWsServerThreadId);
-	if (0 == pthread_join(m_hWsServerThreadId, NULL)) {
-		m_hWsServerThreadId = 0;
-	}
-	else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("thread join web socket server thread failed!");
-	}
-}
-
-const char * CLivenessDetectionEntity::GetEntityName() const
-{
-	return "LivenessDetection";
-}
-
-void CLivenessDetectionEntity::OnPreStart( CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext )
-{
-	ErrorCodeEnum Error = __OnStart(Error_Succeed);
-	pTransactionContext->SendAnswer(Error);
-}
-
-
-void CLivenessDetectionEntity::OnStarted()
-{
-	if (Error_Succeed != GetEntityConfigure()) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[LivenessDetectionFSM] Get Entity Configure Failed!");
-	}
-
-	if (0 != pthread_create(&m_hWsServerThreadId, NULL, start_wsserver, (void*)this)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create web socket server thread failed.");
-	}
-}
-
-void CLivenessDetectionEntity::OnPreClose( EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext )
-{
-	ErrorCodeEnum Error = __OnClose(Error_Succeed);
-	pTransactionContext->SendAnswer(Error);
-}
-
-
-ErrorCodeEnum CLivenessDetectionEntity::__OnStart(ErrorCodeEnum preOperationError)
-{
-	if (preOperationError != Error_Succeed) {
-		return preOperationError;
-	}
-
-	m_eDeviceType = eStand2sType;
-	//is Pad Version
-	CSmartPointer<IEntityFunction> spFunction = GetFunction();
-	CSystemStaticInfo stStaticinfo;
-	spFunction->GetSystemStaticInfo(stStaticinfo);
-	if (_stricmp(stStaticinfo.strMachineType, "RVC.Stand1SPlus") == 0) {
-		m_eDeviceType = eStand1SPlusType;
-	}
-	else{
-		m_eDeviceType = eStand2sType;
-	}
-
-	if (m_eDeviceType >= 0 && m_eDeviceType < sizeof(Device_Type_Table) / sizeof(char*)) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("device type is %s.", Device_Type_Table[m_eDeviceType]);
-	}
-		
-	ErrorCodeEnum Error = Error_Succeed;
-	nActiveCamera = CAMERA_TYPE_ENV;
-	m_iCameraState = 'N';
-	BOOL bRet = FALSE;
-
-	int i = 0;
-	m_arrListener.Init(4);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_BEGIN_HANDLE_BUSINESS, NULL, false);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_END_HANDLE_BUSINESS, NULL, false);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED, NULL, false);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED, NULL, false);
-	
-	GetFunction()->RegistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA,this);
-	GetFunction()->RegistSysVarEvent(SYSVAR_CAMERASTATE,this);
-	CSimpleStringA strValue;
-	GetFunction()->GetSysVar(SYSVAR_CAMERASTATE, strValue);
-	m_iCameraState = strValue[0];
-	if (strValue[0] == 'E'){
-		nActiveCamera = CAMERA_TYPE_OPT;
-	}
-	else if (strValue[0] == 'O'){
-		nActiveCamera = CAMERA_TYPE_ENV;
-	}
-	else if(strValue[0] == 'B') {
-		nActiveCamera = CAMERA_TYPE_ERROR;
-	}
-	else if (strValue[0] == 'N'){
-		nActiveCamera = CAMERA_TYPE_ENV;
-	}
-
-	return Error;
-}
-
-ErrorCodeEnum CLivenessDetectionEntity::__OnClose( ErrorCodeEnum preOperationError )
-{
-	if (preOperationError != Error_Succeed) {
-		return preOperationError;
-	}
-		
-	CSmartPointer<IEntityFunction> spFunction = GetFunction();
-	for (int i = 0; i < m_arrListener.GetCount(); ++i){
-		spFunction->UnsubscribeLog(m_arrListener[i]);
-	}
-
-	ErrorCodeEnum Error = Error_Succeed;
-	return Error;
-}
-
-
-int CLivenessDetectionEntity::GetActiveCamera()
-{
-	return nActiveCamera;
-}
-
-void CLivenessDetectionEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel, const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext& pLinkInfo)
-{
-	switch (dwUserCode) {
-	case LOG_EVT_BEGIN_HANDLE_BUSINESS:
-		break;
-
-	case LOG_EVT_END_HANDLE_BUSINESS:
-		break;
-
-	case LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED:
-		if (!m_pFaceVideo) {
-			m_pFaceVideo = new RvcFaceVideo();
-		}
-		if (eStand1SPlusType == m_eDeviceType) {
-			m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, NULL, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, NULL);
-		}
-		else {
-			m_pFaceVideo->InitVideoQueue(REC_COMMON_VIDEO_ENV_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_OPT_SHM_SNAPSHOT_QUEUE, REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE, REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
-		}
-		break;
-
-	case LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED:
-		if (m_pFaceVideo){
-			delete m_pFaceVideo;
-			m_pFaceVideo = NULL;
-		}
-
-		break;
-	
-	default:
-		break;
-	}
-}
-
-void CLivenessDetectionEntity::OnSysVarEvent( const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName )
-{
-	if (_stricmp(pszKey, SYSVAR_CAMERASTATE) == 0)
-	{
-		m_iCameraState = pszValue[0]; 
-		if (pszValue[0] == 'E')
-		{
-			nActiveCamera = CAMERA_TYPE_OPT;
-		}
-		else if (pszValue[0] == 'O')
-		{
-			nActiveCamera = CAMERA_TYPE_ENV;
-		}
-		else if(pszValue[0] == 'B')   ///////显示贴图
-		{
-			nActiveCamera = CAMERA_TYPE_ERROR;
-		}
-		else if (pszValue[0] == 'N')
-		{
-			nActiveCamera = CAMERA_TYPE_AUTO;
-		}
-	}
-	else if (_stricmp(pszKey, SYSVAR_ACTIVETRACKINGCAMERA) == 0)
-	{
-		if (m_iCameraState == 'N')
-		{
-			if (pszValue[0] == 'E')
-			{
-				nActiveCamera = CAMERA_TYPE_ENV;
-			}
-			else if (pszValue[0] == 'O')
-			{
-				nActiveCamera = CAMERA_TYPE_OPT;
-			}
-		}
-	}
-}
-
-void CLivenessDetectionEntity::OnSelfTest( EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext )
-{
-	if (Test_ShakeHand == eTestType)
-	{
-		pTransactionContext->SendAnswer(Error_Succeed);
-	}
-}
-
-
-
-int CLivenessDetectionEntity::on_get_videodata(eVideoType eType, eCameraType ecameraid, int* width, int* height, unsigned char* bmpdata, int isize)
-{
-	int idatalen = 0;
-	if (!m_pFaceVideo) {
-		return idatalen;
-	}
-	
-	if (ePreview_Type == eType) {
-		idatalen = m_pFaceVideo->GetPreViewVideoFrameSize(ecameraid, width, height);
-	}
-	else {
-		idatalen = m_pFaceVideo->GetVideoFrameSize(ecameraid, width, height);
-	}
-
-	if (0 < idatalen) {
-		video_frame vframe = { 0 };
-		vframe.format = VIDEO_FORMAT_RGB24;
-		vframe.width = *width;
-		vframe.height = *height;
-
-		videoq_frame qvframe = { 0 };
-		qvframe.framesize = idatalen;
-		qvframe.width = *width;
-		qvframe.height = *height;
-		qvframe.data = bmpdata;
-		BOOL bRet = FALSE;
-		if (ePreview_Type == eType) {
-			bRet = m_pFaceVideo->GetPreViewVideoFrame((int)ecameraid, &qvframe, 3);
-		}
-		else {
-			bRet = m_pFaceVideo->GetVideoFrame((int)ecameraid, &qvframe, 2);
-		}
-
-		if (!bRet) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get video frame from queue failed, and picture data length is %d.", idatalen);
-		}
-	}
-	else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get video frame size failed, and picture data length is %d.", idatalen);
-	}
-
-	return idatalen;
-}
-
-ErrorCodeEnum CLivenessDetectionEntity::GetEntityConfigure()
-{
-	CSmartPointer<IConfigInfo> spConfig;
-	ErrorCodeEnum eErrDev;
-	eErrDev = GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
-	if (eErrDev != Error_Succeed) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("open center setting file failed!");
-		return eErrDev;
-	}
-
-	SpIniMappingTable table;
-	table.AddEntryInt("LivenessDetection", "WsServerPort", m_iWsPort, RVC_LIVENESS_WS_PORT);
-	eErrDev = table.Load(spConfig);
-
-	return eErrDev;
-}
-
-SP_BEGIN_ENTITY_MAP()
-	SP_ENTITY(CLivenessDetectionEntity)
-SP_END_ENTITY_MAP()

+ 4 - 10
Module/mod_mediacontroller/unix/capture.cpp

@@ -344,7 +344,6 @@ static int portaudio_capture_start(audio_capture_t* audio_cap)
 	int nId = capture_get_audio_device_id(true, cap->config.strAudioIn);
 	if (nId == -1)
 	{
-		//需�立���的告警使用Severity_High
 		LogWarn(Severity_Middle, Error_Debug,ERROR_MOD_MEDIACONTROLLER_HANDFREEIN_INITFAIL,"hand free in device config error,please check");
 		return Error_AudioIN;
 	}
@@ -386,7 +385,6 @@ static int portaudio_capture_start(audio_capture_t* audio_cap)
 	nId = capture_get_audio_device_id(false, cap->config.strAudioOut);
 	if (nId == -1)
 	{
-		//需�立���的告警使用Severity_High
 		LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_HANDFREEOUT_INITFAIL, "hand free out device config error,please check");
 		return Error_AudioOut;
 	}
@@ -411,9 +409,7 @@ static int portaudio_capture_start(audio_capture_t* audio_cap)
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio capture create error, cannot open output audio device.");
 		return Error_AudioOut;
 	}
-
-	//打开æµ�è?¾å??,å�?以用以下代ç �替æ�¢paError = Pa_OpenStream(&audio_cap->stream, &inParam, &outParam, CAPTURE_CLOCK, 
-	//CAPTURE_FRAME_TIME * CAPTURE_CLOCK/1000, paClipOff|paDitherOff, &StreamCallback, audio_cap);
+	
 	paError = Pa_OpenStream(&audio_cap->stream, &inParam, NULL, inSampleRate,
 		CAPTURE_FRAME_TIME * inSampleRate / 1000, paClipOff | paDitherOff, &StreamCallback, audio_cap);
 
@@ -460,7 +456,6 @@ static int record_portaudio_capture_start(rvc_audio_capture_t* audio_cap)
 	int nId = capture_get_audio_device_id(true, cap->rvc_audio_config.strAudioIn);
 	if (nId == -1)
 	{
-		//需�立���的告警使用Severity_High
 		LogWarn(Severity_Middle, Error_Debug,ERROR_MOD_MEDIACONTROLLER_HANDFREEIN_INITFAIL,"hand free in device config error,please check");
 		return Error_AudioIN;
 	}
@@ -588,7 +583,6 @@ static int pulseaudio_capture_start(audio_capture_t* audio_cap)
 		int nId = audio_cap->paudiocap->audio_get_device_id(cap->config.strAudioIn.GetData(), true);
 		if (nId == -1)
 		{
-			//需�立���的告警使用Severity_High
 			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_HANDFREEIN_INITFAIL, "hand free in device config error,please check");
 			return Error_AudioIN;
 		}
@@ -678,7 +672,6 @@ static int record_pulseaudio_capture_start(rvc_audio_capture_t* audio_cap)
 		audiocap_param_t param = { 0 };
 		int nId = audio_cap->paudiocap->audio_get_device_id(cap->rvc_audio_config.strAudioIn.GetData(), true);
 		if (nId == -1){
-			//需�立���的告警使用Severity_High
 			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_HANDFREEIN_INITFAIL, "hand free in device config error,please check");
 			return Error_AudioIN;
 		}
@@ -2090,12 +2083,13 @@ namespace MediaController {
 		{
 			int inumber = 0;
 			int icount = rvc_videocap_get_device_count();
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("camera count is %d.", icount);
 			for (int i = 0; i < 64 && inumber < icount; ++i) {
 				char strcamera[2 * MAX_PATH] = { 0 };
 				char strpath[MAX_PATH] = { 0 };
 
 				if (0 == rvc_videocap_get_device_fullpathname(i, strcamera, 2 * MAX_PATH)){
-					inumber++;
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", inumber++, strcamera);
 				}
 			}
 		}
@@ -2121,7 +2115,7 @@ namespace MediaController {
 
             if (0 == rvc_videocap_get_device_fullpathname(i, strcamera, 2 * MAX_PATH)) {
                 tmp[inumber] = strcamera;
-                inumber++;
+                DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", inumber++, strcamera);
             }
         }
         cams.Copy(tmp, 0, inumber);

+ 6 - 6
Module/mod_mediacontroller/unix/mod_mediacontroller.cpp

@@ -210,8 +210,8 @@ void CMediaControllerEntity::OnStarted()
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SelfcheckClient connect fail!");
 	}
 
-	if (Error_Succeed == GetMediaConfig()) {
-
+	if (Error_Succeed != GetMediaConfig()) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get entity config from config failed!");
 	}
 
 	memset(&conf, 0, sizeof(capture_config_t));
@@ -347,12 +347,15 @@ ErrorCodeEnum CMediaControllerEntity::RvcGetAudioDevice()
 	ErrorCodeEnum Error = Error_Param;
 	if (NULL != m_pAudioCap){
 		int icountmic = m_pAudioCap->audio_get_device_count(true);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio input devices(%d):", icountmic);
 		int i = 0;
 		for (; i < icountmic; i++) {
 			char strname[MAX_PATH] = { 0 };
 			m_pAudioCap->audio_get_device_name(strname, MAX_PATH, true, i);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", i, strname);
 		}
 		int icountspeaker = m_pAudioCap->audio_get_device_count(false);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio output devices(%d):", icountspeaker);
 		for (i = 0; i < icountspeaker; i++) {
 			char strname[MAX_PATH] = { 0 };
 			m_pAudioCap->audio_get_device_name(strname, MAX_PATH, false, i);
@@ -466,10 +469,7 @@ ErrorCodeEnum CMediaControllerEntity::GetMediaConfig()
 		Error = table.Load(spConfig);
 	}
 
-	if (Error_Succeed != Error) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get entity config from config failed!");
-	}
-	else {
+	if (Error_Succeed == Error) {
 		if (1 == iCamOnMode && 1 == iRecordMode) {
 			m_iCamOnMode = 1;
 		}

+ 0 - 6
Module/mod_recorder/unix/mod_recorder.cpp

@@ -636,12 +636,6 @@ DeviceTypeEnum CRecorderEntity::RvcGetDeviceType()
 			eType = eMobilePadType;
 		}
 	}
-	else if (_stricmp(stStaticinfo.strMachineType, "RPM.Stand1S") == 0) {
-		eType = eRpm1sType;
-	}
-	else if (_stricmp(stStaticinfo.strMachineType, "RVC.Desk1S") == 0) {
-		eType = eDesk1SType;
-	}
 	else if (stricmp(stStaticinfo.strMachineType, "RVC.CardStore") == 0 || stricmp(stStaticinfo.strMachineType, "RVC.CardPrinter") == 0) {
 		eType = eCardStore;
 	}

+ 0 - 1
Module/mod_sipphone/unix/audio_session.cpp

@@ -912,7 +912,6 @@ static void __stdcall __audio_log_func(int level, const char *s)
 
 int audio_lib_init()
 {
-	LOG_FUNCTION();
 	audio_log_set_func(&__audio_log_func);
 	int rc = audioframework_init();
 

+ 4 - 0
Module/mod_sipphone/unix/mod_sipphone.cpp

@@ -1176,15 +1176,19 @@ ErrorCodeEnum CSIPEntity::RvcGetAudioDeviceInfo()
 	ErrorCodeEnum Error = Error_Param;
 	if (NULL != m_pAudioMgr) {
 		int icountmic = m_pAudioMgr->audio_get_device_count(true);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio input devices(%d):", icountmic);
 		int i = 0;
 		for (; i < icountmic; i++) {
 			char strname[MAX_PATH] = { 0 };
 			m_pAudioMgr->audio_get_device_name(strname, MAX_PATH, true, i);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", i, strname);
 		}
 		int icountspeaker = m_pAudioMgr->audio_get_device_count(false);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("audio output devices(%d):", icountspeaker);
 		for (i = 0; i < icountspeaker; i++) {
 			char strname[MAX_PATH] = { 0 };
 			m_pAudioMgr->audio_get_device_name(strname, MAX_PATH, false, i);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%d = %s", i, strname);
 		}
 		Error = Error_Succeed;
 	}

+ 0 - 3
Other/unix/rvcmediacommon/rvc_media_common.h

@@ -88,9 +88,6 @@
 
 #define REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE		"A15A1AE4-8846-43D6-9A74-198E311C2D21"	//"rvc.shm.rtp.video.remote.q"		    // 320x240@8fps //远端视频
 
-//#define REC_COMMON_VIDEO_ENV_SHM_RENDER_QUEUE		"46051A23-9E01-4973-A51A-357A557167A8"	//"rvc.shm.render.video.env.q"			// 640x360@10fps I420
-//#define REC_COMMON_VIDEO_OPT_SHM_RENDER_QUEUE		"C46C102C-F656-4B04-8B0D-31B71AD696B0"	//"rvc.shm.render.video.opt.q"			// 640x360@10fps I420
-
 #define REC_COMMON_AUDIO_SHM_QUEUE		            "FC5DFFDE-DA1F-4321-80EC-B9B03FD8BB95"	//"rvc.shm.audio.q"
 #define REC_COMMON_AUDIO_SALESOL_SHM_QUEUE		    "54A66218-7FAD-4A73-85CD-3BAF89EDED02"	//"rvc.shm.salesol_audio.q"
 #define REC_COMMON_AUDIO_SALES_SHM_QUEUE		    "72030F8D-5248-434C-BB36-FB0871EE461D"	//"rvc.shm.sales_audio.q"