Эх сурвалжийг харах

!10141 解决自动核身失败问题
Merge pull request !10141 from 80374374/dev_compiler_upgrade

Gifur 1 жил өмнө
parent
commit
65e6b0319b

+ 4 - 4
Module/mod_facetracking/mod_facetracking.cpp

@@ -133,8 +133,8 @@ public:
 			spFunction->SetTimer(1, this, 500);
 		}
 		spFunction->SubscribeLog(m_UUid1, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_HEADLIGHT_GREEN_OFF,NULL,false);
-		spFunction->SubscribeLog(m_UUid2, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_BEGIN_FACETRACKING,NULL,false);
-		spFunction->SubscribeLog(m_UUid3, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_END_FACETRACKING,NULL,false);
+		spFunction->SubscribeLog(m_UUid2, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED,NULL,false);
+		spFunction->SubscribeLog(m_UUid3, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED,NULL,false);
 		pTransactionContext->SendAnswer(Error);
 	}
 
@@ -183,7 +183,7 @@ public:
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set light change");
 			m_facecapture->SetLightChange();
 		}
-		else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_BEGIN_FACETRACKING)
+		else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED)
 		{
 			CSimpleStringA strValue;
 			GetFunction()->GetSysVar("CameraState", strValue);
@@ -222,7 +222,7 @@ public:
 			}	
 #endif //RVC_OS_WIN
 		}
-		else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_END_FACETRACKING)
+		else if (dwUserCode == LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop Camera,set camera stat to Error, and stop face capture!");
 #if defined(RVC_OS_LINUX)

+ 0 - 5
Module/mod_livenessdetection/mod_livenessdetection.h

@@ -89,15 +89,10 @@ private:
 	virtual void OnSysVarEvent(const char *pszKey, const char *pszValue,const char *pszOldValue,const char *pszEntityName);
 
 	virtual void OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext);
-	
-#if defined(RVC_OS_LINUX)
-	ErrorCodeEnum DecideCameraCount(int& nCount);
-#endif //RVC_OS_LINUX
 
 	DeviceTypeEnum m_eDeviceType;
 	int nActiveCamera;
 	int m_iCameraState;
-	
 
 	CAutoArray<CUUID> m_arrListener;
 	BOOL m_bStarted;

+ 8 - 4
Module/mod_livenessdetection/unix/mod_livenessdetection.cpp

@@ -112,6 +112,10 @@ ErrorCodeEnum CLivenessDetectionEntity::__OnStart(ErrorCodeEnum preOperationErro
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the type is standard");
 		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;
@@ -122,8 +126,8 @@ ErrorCodeEnum CLivenessDetectionEntity::__OnStart(ErrorCodeEnum preOperationErro
 	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_BEGIN_FACETRACKING, NULL, false);
-	GetFunction()->SubscribeLog(m_arrListener[i++], this, Log_Event, Severity_Middle, Error_IgnoreAll, LOG_EVT_MEDIACONTROLLER_END_FACETRACKING, 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);
@@ -179,7 +183,7 @@ void CLivenessDetectionEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUU
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("end handle business.");
 		break;
 
-	case LOG_EVT_MEDIACONTROLLER_BEGIN_FACETRACKING:
+	case LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start camera, begin facetracking.");
 		if (!m_pFaceVideo) {
 			m_pFaceVideo = new RvcFaceVideo();
@@ -192,7 +196,7 @@ void CLivenessDetectionEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUU
 		}
 		break;
 
-	case LOG_EVT_MEDIACONTROLLER_END_FACETRACKING:
+	case LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop camera, end facetracking.");
 		if (m_pFaceVideo){
 			delete m_pFaceVideo;

+ 2 - 2
Module/mod_mediacontroller/Event.h

@@ -73,8 +73,8 @@
 #define ERROR_MOD_MEDIACONTROLLER_CONFIG_ALLERROR			0x20880050  //配置的摄像头都故障
 
 
-#define LOG_EVT_MEDIACONTROLLER_BEGIN_FACETRACKING			0x20890001	//开始人脸捕获
-#define LOG_EVT_MEDIACONTROLLER_END_FACETRACKING			0x20890002  //停止人脸捕获
+#define LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED				0x20890001	//摄像头已开启
+#define LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED				0x20890002  //摄像头已关闭
 
 #define LOG_EVT_MEDIACONTROLLER_SETTIMER_ERROR				0x20890003	//设置定时器异常
 #define LOG_EVT_MEDIACONTROLLER_KILLTIMER_ERROR				0x20890004  //停止定时器异常

+ 2 - 2
Module/mod_mediacontroller/mod_mediacontroller.h

@@ -124,8 +124,8 @@ private:
 	ErrorCodeEnum AutoGetVideoDeviceName(capture_config_t* conf);
 	ErrorCodeEnum RvcGetAudioDevice();
 	void CheckAutoVideoConfig(capture_config_t* conf);
-	void StartFacetracking();
-	void StopFacetracking();
+	void OnCameraStarted();
+	void OnCameraStopped();
 #endif //RVC_OS_WIN
 	
 	ErrorCodeEnum GetSalesAudioConfig(rvc_audio_capture_config_t *conf, bool bRemoteRecord);

+ 12 - 16
Module/mod_mediacontroller/unix/mod_mediacontroller.cpp

@@ -73,7 +73,7 @@ void CMediaControllerEntity::OnSysVarEvent(const char *pszKey, const char *pszVa
 				if (!m_bStartCamera) {
 					StartCameraAndSetSysVar();
 					if (m_bStartCamera) {
-						StartFacetracking();
+						OnCameraStarted();
 					}
 				}
 				else {
@@ -322,7 +322,7 @@ void CMediaControllerEntity::OnStarted()
 			CSmartPointer<IEntityFunction> Func = GetFunction();
 			Func->GetSysVar("SessionID", strSessionId);
 			LogEvent(Severity_Middle, EVENT_MOD_BEGIN_RECORD, strSessionId);
-			StartFacetracking();
+			OnCameraStarted();
 		}
 	}
 
@@ -626,7 +626,7 @@ void CMediaControllerEntity::OnTimeout(DWORD dwTimerID)
 		GetFunction()->GetSysVar(SYSVAR_CALLSTATE, strCallState);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Timer 3 strCallState = %s", strCallState.GetData());
 		if ('O' == strCallState[0] && m_bStartCamera) {
-			StopFacetracking();
+			OnCameraStopped();
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop camera.");
 			if (m_capture){
 				GetFunction()->KillTimer(1);
@@ -1418,7 +1418,7 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 
 					if (m_bStartCamera) {
 						LogEvent(Severity_Middle, EVENT_MOD_BEGIN_RECORD, pszMessage);
-						StartFacetracking();
+						OnCameraStarted();
 					}
 				}
 			}
@@ -1431,7 +1431,7 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 			if (!m_bStartCamera){
 				StartCameraAndSetSysVar();
 				if (m_bStartCamera) {
-					StartFacetracking();
+					OnCameraStarted();
 				}
 			}
 			else {
@@ -1472,7 +1472,7 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop camera.");
 					if (m_capture)
 					{
-						StopFacetracking();
+						OnCameraStopped();
 						LogEvent(Severity_Middle, EVENT_MOD_END_RECORD, pszMessage);
 						GetFunction()->KillTimer(1);
 						capture_stop(m_capture);
@@ -1834,7 +1834,7 @@ ErrorCodeEnum CMediaControllerEntity::ExternStartCamera()
 		StartCameraAndSetSysVar();
 		if (m_bStartCamera) {
 			LogEvent(Severity_Middle, EVENT_MOD_BEGIN_RECORD, strSessionId);
-			StartFacetracking();
+			OnCameraStarted();
 		}
 	}
 	m_bExternControlCam = FALSE;
@@ -1846,7 +1846,7 @@ ErrorCodeEnum CMediaControllerEntity::ExternStopCamera()
 {
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Extern stop camera");
 	if (m_capture) {
-		StopFacetracking();
+		OnCameraStopped();
 		LogEvent(Severity_Middle, EVENT_MOD_END_RECORD,NULL);
 		GetFunction()->KillTimer(1);
 		capture_stop(m_capture);
@@ -2052,19 +2052,15 @@ void CMediaControllerEntity::CheckAutoVideoConfig(capture_config_t* conf)
 }
 
 
-void CMediaControllerEntity::StartFacetracking()
+void CMediaControllerEntity::OnCameraStarted()
 {
-	if (eStand2sType == m_eDeviceType) {
-		LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_BEGIN_FACETRACKING, "start facetracking.");
-	}
+	LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_CAMERA_STARTED, "camera started.");
 }
 
 
-void CMediaControllerEntity::StopFacetracking()
+void CMediaControllerEntity::OnCameraStopped()
 {
-	if (eStand2sType == m_eDeviceType) {
-		LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_END_FACETRACKING, "stop facetracking.");
-	}
+	LogEvent(Severity_Middle, LOG_EVT_MEDIACONTROLLER_CAMERA_STOPPED, "camera stopped.");
 }