瀏覽代碼

Z991239-6192 #comment: 摄像头告警优化

80274480 4 月之前
父節點
當前提交
7253a46fb7

+ 34 - 14
Module/mod_mediacontroller/capture.cpp

@@ -249,16 +249,16 @@ static int StreamCallback(const void *input,
 		if (!audio_cap->shm_queue->InsertAudio(&frm, unowtime)) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[StreamCallback] InsertAudio to shm_queue failed! frameCount:%d", frameCount);
 		}
-		else {
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->shm_queue->GetAudioLens(), frm.iseriesnumber);
-		}
+		//else {
+		//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d, and now time is %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->shm_queue->GetAudioLens(), frm.iseriesnumber, unowtime);
+		//}
 
 		if (!audio_cap->salesol_shm_queue->InsertAudio(&frm)) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[StreamCallback] InsertAudio to salesol_shm_queue failed! frameCount:%d", frameCount);
 		}
-		else {
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to salesol_shm_queue success! and framesize is :%d, and salesol_shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->salesol_shm_queue->GetAudioLens(), frm.iseriesnumber);
-		}
+		//else {
+		//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to salesol_shm_queue success! and framesize is :%d, and salesol_shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->salesol_shm_queue->GetAudioLens(), frm.iseriesnumber);
+		//}
 	}
 
 	if (output) {
@@ -295,9 +295,9 @@ static int Sales_StreamCallback(const void *input,
 		if (!audio_cap->audio_shm_queue->InsertAudio(&frm)) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("[Sales_StreamCallback] InsertAudio failed! frameCount:%d", frameCount);
 		}
-		else {
-			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to audio_shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->audio_shm_queue->GetAudioLens(), frm.iseriesnumber);
-		}
+		//else {
+		//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to audio_shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->audio_shm_queue->GetAudioLens(), frm.iseriesnumber);
+		//}
 	}
 
 	if (output) {
@@ -497,11 +497,12 @@ static void audio_data_callback(const void* input, unsigned long audiolen, void*
 			}
 			frm.iseriesnumber = audio_cap->iseriesnumber;
 
-			if (!audio_cap->shm_queue->InsertAudio(&frm)) {
+			int unowtime = y2k_time_now();
+			if (!audio_cap->shm_queue->InsertAudio(&frm, unowtime)) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to shm_queue failed!", __FUNCTION__, __LINE__);
 			}
 			//else {
-			//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->shm_queue->GetAudioLens(), frm.iseriesnumber);
+			//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to shm_queue success! and framesize is :%d, and shm_queue length is %d, frm.iseriesnumber = %d, and now time is %d.", __FUNCTION__, __LINE__, frm.framesize, audio_cap->shm_queue->GetAudioLens(), frm.iseriesnumber, unowtime);
 			//}
 			audio_cap->uaudiolen -= RVC_AUDIO_BUFFER_LEN;
 		}
@@ -586,9 +587,9 @@ static void record_audio_data_callback(const void* input, unsigned long audiolen
 			if (!audio_cap->audio_shm_queue->InsertAudio(&frm)) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to audio_shm_queue failed!", __FUNCTION__, __LINE__);
 			}
-			else {
-				//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to audio_shm_queue success!", __FUNCTION__, __LINE__);
-			}
+			//else {
+			//	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d InsertAudio to audio_shm_queue success!", __FUNCTION__, __LINE__);
+			//}
 			
 			audio_cap->uaudiolen -= RVC_AUDIO_BUFFER_LEN;
 		}
@@ -1802,6 +1803,24 @@ namespace MediaController {
 		}
 	}
 
+	int capture_detect_audioin_bug(capture_t* cap, int* audioin_n)
+	{
+		*audioin_n = 0;
+		if (cap->handfree_audio)
+		{
+			if (cap->handfree_audio->shm_queue)
+			{
+				*audioin_n = cap->handfree_audio->shm_queue->GetAudioLens();
+			}
+		}
+		else
+		{
+			*audioin_n = -1;
+		}
+
+		return 0;
+	}
+
 	int capture_detect_camera_bug(capture_t *cap, int *env_n, int *opt_n, bool bsinglecam)
 	{
 		*env_n = 0;
@@ -1836,6 +1855,7 @@ namespace MediaController {
 				*opt_n = 1;
 			}
 		}
+
 		return 0;
 	}
 

+ 7 - 3
Module/mod_mediacontroller/capture.h

@@ -54,9 +54,11 @@ extern "C"{
 #define RVC_CAM_INTERVAL_TIME 3000
 #endif // !RVC_CAM_INTERVAL_TIME
 
-#ifndef MAX_PATH
-#define MAX_PATH 260
-#endif
+#ifndef AUDIO_BUG_THRESHOLD
+#define AUDIO_BUG_THRESHOLD 6
+#endif // !AUDIO_BUG_THRESHOLD
+
+
 
 namespace MediaController {
 	typedef struct capture_t capture_t;
@@ -182,9 +184,11 @@ namespace MediaController {
 	void capture_stop(capture_t *cap);
 	int capture_lib_init(int* ivideonum);
 
+
 	int capture_detect_camera_bug(capture_t *cap, int *env_n, int *opt_n, bool bsinglecam);
 	int capture_get_last_frametime(capture_t *cap, unsigned int* env_n, unsigned int* opt_n);
 	
+	int capture_detect_audioin_bug(capture_t* cap, int* audioin_n);
 	int capture_get_last_audio_frametime(capture_t* cap, unsigned int* handfreein_n);
 
 	int salesaudio_capture_create(rvc_audio_capture_config_t *config, rvc_sales_audio_capture_t **p_cap);

+ 23 - 27
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -616,11 +616,30 @@ void CMediaControllerEntity::OnTimeHandfreeMicroStatusCheck()
 		return;
 	}
 
+	int audioin_n = -1;
 	unsigned int nHandfreeinAudioTime = 0;
+	static int iAudioInEmptyTimes = 0;
 
+	capture_detect_audioin_bug(m_capture, &audioin_n);
 	capture_get_last_audio_frametime(m_capture, &nHandfreeinAudioTime);
 
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("======last audio time is %d.======", nHandfreeinAudioTime);
+
+	if (audioin_n == 0) {
+		if (iAudioInEmptyTimes < AUDIO_BUG_THRESHOLD) {
+			iAudioInEmptyTimes++;
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get handfree in audio fail, times=%d.", iAudioInEmptyTimes);
+		}
+	}
+	else if (audioin_n == -1) {
+		iAudioInEmptyTimes = AUDIO_BUG_THRESHOLD;
+	}
+	else {
+		if (iAudioInEmptyTimes == AUDIO_BUG_THRESHOLD) {
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("handfree in get audio success again.");
+		}
+		iAudioInEmptyTimes = 0;
+	}
 }
 
 void CMediaControllerEntity::OnTimeCameraStatusCheck()
@@ -642,7 +661,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 	if (env_n == 0) {
 		if (iEnvEmptyTimes < CAMERA_BUG_THRESHOLD){
 			iEnvEmptyTimes++; 
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get env camera picture fail, times=%d.",iEnvEmptyTimes);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("get env camera picture fail, times=%d.", iEnvEmptyTimes);
 		}	
 	} 
 	else if (env_n == -1){
@@ -671,7 +690,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 	}
 
 	//env是否30S没有图像或者图像15秒没有更新
-	if(((iEnvEmptyTimes == CAMERA_BUG_THRESHOLD)||bEnvTimeout)&&(m_nCameraErrorCode!=Error_EnvCamera)&&(m_nCameraErrorCode!=Error_AllCamera))
+	if(((iEnvEmptyTimes == CAMERA_BUG_THRESHOLD)||bEnvTimeout)&&(m_nCameraErrorCode != Error_EnvCamera)&&(m_nCameraErrorCode != Error_AllCamera))
 	{
 		char strMessage[MAX_PATH*2] = {0};
 		get_camera_exception_message(strMessage, MAX_PATH*2, conf.strVideoEnv, "Env camera bug detected!");
@@ -1365,12 +1384,12 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 			Error = CheckConfigCameraName(conf, m_eDeviceType);
 			if (Error == Error_EnvCamera){
 				char strMessage[MAX_PATH*2] = {0};
-				get_camera_exception_message(strMessage, MAX_PATH*2, conf->strVideoEnv ,"env camera config error,please check config file or device.");
+				get_camera_exception_message(strMessage, MAX_PATH*2, conf->strVideoEnv ,"env camera config error, please check config file or device.");
 				LogWarn(Severity_Middle,Error_DevMedia,ERROR_MOD_MEDIACONTROLLER_ENVCAM_INITFAIL,strMessage);
 				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V2").setResultCode("RTA2801")("上摄像头配置错误,请检查摄像头配置");
 			} else if (Error == Error_OptCamera){
 				char strMessage[MAX_PATH*2] = {0};
-				get_camera_exception_message(strMessage, MAX_PATH*2, conf->strVideoOpt, "operation camera config error,please check config file or device.");
+				get_camera_exception_message(strMessage, MAX_PATH*2, conf->strVideoOpt, "operation camera config error, please check config file or device.");
 				LogWarn(Severity_Middle,Error_DevMedia,ERROR_MOD_MEDIACONTROLLER_OPTCAM_INITFAIL, strMessage);
 				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402208V2").setResultCode("RTA2802")("下摄像头配置错误,请检查摄像头配置");
 			}
@@ -1394,21 +1413,6 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 }
 
 
-void CMediaControllerEntity::OnExternalCameraSwitchFailed(const char* pszFailedMsg)
-{
-	CSmartPointer<IEntityFunction> Func = GetFunction();
-	CSimpleStringA strValue;
-	Func->GetSysVar("DesktopType", strValue);
-	if (strValue == CSimpleStringA("U")) {
-#ifdef RVC_OS_WIN
-		MessageBoxA(NULL, pszFailedMsg, NULL, MB_SYSTEMMODAL);
-#else
-
-#endif // RVC_OS_WIN
-	}
-}
-
-
 #ifdef DEVOPS_ON_PRD
 #else
 #ifdef RVC_OS_WIN
@@ -1596,8 +1600,6 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 
 	case  LOG_EVT_UI_RECORDFAILED: 
 		{
-			OnExternalCameraSwitchFailed(pszMessage);
-
 			GetFunction()->KillTimer(RVC_MEDIADEV_STATUS_CHECK_TIMER);
 			if (m_bIsRemoteRecord){
 				LogEvent(Severity_Middle, LOG_EVT_UI_STOPREMOTERECORD, NULL);
@@ -2268,11 +2270,9 @@ void CMediaControllerEntity::GetCameraBrightness(SpReqAnsContext<MediaService_Ge
 	else {
 		ctx->Ans.result = -1;
 		if (0 == ctx->Req.icameraid) {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280D").setAPI(__FUNCTION__)("上摄像头故障,请联系厂商排查");
 			ctx->Answer(Error_EnvCamera, LOG_WARN_ENVCAMERA_ERROR);
 		}
 		else if (1 == ctx->Req.icameraid) {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280E").setAPI(__FUNCTION__)("下摄像头故障,请联系厂商排查");
 			ctx->Answer(Error_OptCamera, LOG_WARN_OPTCAMERA_ERROR);
 		}
 	}
@@ -2288,11 +2288,9 @@ void CMediaControllerEntity::SetCameraBrightness(SpReqAnsContext<MediaService_Se
 	else {
 		ctx->Ans.result = -1;
 		if (0 == ctx->Req.icameraid) {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280D").setAPI(__FUNCTION__)("上摄像头故障,请联系厂商排查");
 			ctx->Answer(Error_EnvCamera, LOG_WARN_ENVCAMERA_ERROR);
 		}
 		else if (1 == ctx->Req.icameraid) {
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA280E").setAPI(__FUNCTION__)("下摄像头故障,请联系厂商排查");
 			ctx->Answer(Error_OptCamera, LOG_WARN_OPTCAMERA_ERROR);
 		}
 	}
@@ -2633,10 +2631,8 @@ void MediaServiceSession::Handle_TurnOnCamera(SpReqAnsContext<MediaService_TurnO
 	}
 	else {
 		ctx->Ans.result = -3;
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2808").setAPI(__FUNCTION__)("摄像头故障,请联系厂商排查");
 		ctx->Answer(Error_AllCamera, LOG_WARN_ALLCAMERA_ERRORS);
 	}
-	//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Error = %d, CameraErrorCode = %d, result = %d.", Error, CameraErrorCode, ctx->Ans.result);
 }
 
 void MediaServiceSession::Handle_TurnOffCamera(SpReqAnsContext<MediaService_TurnOffCamera_Req, MediaService_TurnOffCamera_Ans>::Pointer ctx)

+ 0 - 1
Module/mod_mediacontroller/mod_mediacontroller.h

@@ -105,7 +105,6 @@ public:
 
 	ErrorCodeEnum GetSalesAudioConfig(rvc_audio_capture_config_t *conf, bool bRemoteRecord);
 	ErrorCodeEnum LoadConfig(capture_config_t* conf);
-	void OnExternalCameraSwitchFailed(const char* pszFailedMsg);
 	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,
 		const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo);	

+ 0 - 2
Module/mod_sipphone/mod_sipphone.cpp

@@ -1507,7 +1507,6 @@ void CSIPEntity::HandleSendBroadcastMsg(bool bHandfreeError)
 			evt.strmessage = CSimpleStringA2W("免提设备故障,请使用话筒办理业务");
 			SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchHandFree UIMessageBox.");
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA3107")("免提设备故障,请使用话筒办理业务");
 			m_bMessageBox = false;
 		}
 		else {
@@ -1522,7 +1521,6 @@ void CSIPEntity::HandleSendBroadcastMsg(bool bHandfreeError)
 			evt.strmessage = CSimpleStringA2W("话筒设备故障,请使用免提办理业务");
 			SpSendBroadcast(GetFunction(), SP_MSG_OF(UIMessageBox), SP_MSG_SIG_OF(UIMessageBox), evt);
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SpSendBroadcast SwitchPickup UIMessageBox.");
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA3108")("话筒设备故障,请使用免提办理业务");
 			m_bMessageBox = false;
 		}
 		else {

+ 1 - 0
Other/libaudioqueue/libaudioqueue.cpp

@@ -64,6 +64,7 @@ public:
 	{
 		ClearAudioQueue();
 	}
+
 	//初始化队列
 	bool InitQueue(const char* szName,int framesize=MAX_AUDIOQNODE_SIZE)
 	{