Bladeren bron

Z991239-1812 #comment other 优化关闭摄像头功能

陈礼鹏80274480 4 jaren geleden
bovenliggende
commit
425625f3f8

+ 5 - 1
Module/mod_mediacontroller/capture.cpp

@@ -1081,7 +1081,11 @@ static void video_capture_stop(video_capture_t *video_cap)
 		video_cap->cap = NULL;
 	}
 #else
-
+	if (video_cap->pVideoCap) {
+		video_cap->pVideoCap->StopVideoCapture();
+		delete video_cap->pVideoCap;
+		video_cap->pVideoCap = NULL;
+	}
 #endif // RVC_OS_WIN
 }
 

+ 1 - 91
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -1275,61 +1275,6 @@ private:
 		}
 	}
 
-	// comment by ly@2019/03/19
-	//ErrorCodeEnum TryStartCamera()
-	//{
-	//	Dbg("[dbg] StartExternalCamera");
-	//	ErrorCodeEnum errorCode = StartUSBCamera();
-	//	Dbg("StartExternalCamera:0x%x", errorCode);
-	//	int nRetCod = 5;
-	//	switch(errorCode)
-	//	{
-	//		case Error_Succeed:
-	//			{
-	//				nRetCod = 0; // 正常
-	//				/// add by ly at 20161017
-	//				/// notify to rvcweb that outer camera switch has finished
-	//				ExternalCameraStateChanged evt;
-	//				evt.statemsg = CSimpleStringA2W("已切换到外接摄像头!");
-	//				evt.camname = CSimpleStringA2W(strUSBCam);
-	//				SpSendBroadcast(GetFunction(), SP_MSG_OF(ExternalCameraStateChanged), SP_MSG_SIG_OF(ExternalCameraStateChanged), evt);
-	//				Dbg("[dbg] ExternalCameraStateChanged broadcast sent!");
-	//			}
-	//			break;
-	//		case Error_Resource:
-	//			nRetCod = 1; // 外接摄像头未插入
-	//			break;
-	//		case Error_EnvCamera:
-	//		case Error_AllCamera:
-	//			nRetCod = 2; // 外接摄像头启动失败
-	//			OnExternalCameraSwitchFailed(SwitchFailed_StartFault);
-	//			break;
-	//		case Error_DevNotAvailable:
-	//			nRetCod = 3; // 检测到一个外接摄像头,但无法分辨名称
-	//			OnExternalCameraSwitchFailed(SwitchFailed_Ambiguous);
-	//			break;
-	//		case Error_Duplication:
-	//			nRetCod = 4; // 检测到两个以上外接摄像头
-	//			OnExternalCameraSwitchFailed(SwitchFailed_NoUnique);
-	//			break;
-	//		default:
-	//			nRetCod = 5; // 其他错误
-	//			OnExternalCameraSwitchFailed(SwitchFailed_StartFault);
-	//			break;
-	//	}
-	//	if (m_bStartCamera == FALSE) // 外接没启动成,如果内置没启动,切换到内置
-	//	{
-	//		SetCameraSysVar(CAMERA_START_ING);
-	//		ExternalCameraStateChanged evt;
-	//		evt.statemsg = CSimpleStringA2W("无法启动外接,内置切换中……");
-	//		evt.camname = CSimpleStringA2W(strEnvCam);
-	//		SpSendBroadcast(GetFunction(), SP_MSG_OF(ExternalCameraStateChanged), SP_MSG_SIG_OF(ExternalCameraStateChanged), evt);
-	//		Dbg("[dbg] ExternalCameraStateChanged broadcast sent!");
-	//		return StopUSBCamera();
-	//	}
-
-	//	return Error_Succeed;
-	//}
 
 	virtual void 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, 
@@ -1442,7 +1387,7 @@ private:
 		case EVENT_MOD_CUSTOMERAWARE_END:
 			{
 				m_bCustomerwareBegin = false;
-				if (/*m_bIsPadType&&*/m_bStartCamera&&!m_bExternControlCam)
+				if (m_bStartCamera&&!m_bExternControlCam)
 				{
 					Dbg("stop camera");
 					if (m_capture) 
@@ -1470,41 +1415,6 @@ private:
 						StartCameraAndTiggerRecord((LPCTSTR)strSessionId);
 					}
 				}
-		
-				// comment by ly@2019/03/19
-				//::Sleep(2000); // 延迟2s后判断
-				//// 如果不是广角摄像头 edit by ly at 20161216
-				//if(!strstr((LPCTSTR)strEwsCam,pszMessage))
-				//{
-				//	if (strUSBCam.GetLength() <= 1)
-				//	{
-				//		strUSBCam = pszMessage;
-				//		// 对低柜双屏版屏蔽外接摄像头插入事件 edit by ly@2018/10
-				//		if (eDesk2SType != m_eDeviceType)
-				//		{
-				//			// 广播给业务系统
-				//			ExternalCameraInserted evt;
-				//			evt.camname = CSimpleStringA2W(strUSBCam);
-				//			SpSendBroadcast(GetFunction(), SP_MSG_OF(ExternalCameraInserted), SP_MSG_SIG_OF(ExternalCameraInserted), evt);
-				//			Dbg("[dbg] ExternalCameraInserted broadcast sent!");
-				//		}
-
-				//		/// add by ly at 20161017
-				//		/// notify to rvcweb that outer camera is switching
-				//		SetCameraSysVar(CAMERA_START_ING);
-				//		ExternalCameraStateChanged evt1;
-				//		evt1.statemsg = CSimpleStringA2W("外接摄像头切换中,请稍等……");
-				//		evt1.camname = CSimpleStringA2W(strUSBCam);
-				//		SpSendBroadcast(GetFunction(), SP_MSG_OF(ExternalCameraStateChanged), SP_MSG_SIG_OF(ExternalCameraStateChanged), evt1);
-				//		Dbg("[dbg] ExternalCameraStateChanged broadcast sent!");
-
-				//		TryStartCamera();
-				//	}
-				//	else
-				//	{
-				//		Dbg("[dbg] more than one USBCam inserted!");
-				//	}
-				//}
 			}
 			break;
 

+ 5 - 0
Module/mod_mediacontroller/videocapobj.cpp

@@ -40,6 +40,11 @@ int VideoCapObj::StartVideoCapture()
 	return m_pVideoCap->StartVideoCapture();
 }
 
+int VideoCapObj::StopVideoCapture()
+{
+	return m_pVideoCap->StopVideoCapture();
+}
+
 
 
 void VideoCapObj::Debug(const char* fmt, ...)

+ 1 - 0
Module/mod_mediacontroller/videocapobj.h

@@ -16,6 +16,7 @@ public:
 	int Init();
 	int SetVideoCaptureParam(videocap_param_t* param);
 	int StartVideoCapture();
+	int StopVideoCapture();
 	
 private:
 	IVideoCapture* m_pVideoCap;

+ 1 - 1
Module/mod_sipphone/mod_sipphone.cpp

@@ -287,7 +287,7 @@ public:
 		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)
 	{
-		LOG_TRACE("user_code = %08x", dwUserCode);
+		LOG_TRACE("user_code = 0x%08x", dwUserCode);
 		switch (dwUserCode)
 		{
 		case LOG_EVT_SELFCHECK_ASSISTANTCHANNEL_IDLE: