Browse Source

Z991239-4157 #comment 增加声卡和摄像头配置信息告警

80274480 2 years ago
parent
commit
9889e46a0c

+ 12 - 0
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -1164,6 +1164,12 @@ ErrorCodeEnum CMediaControllerEntity::AutoGetVideoDeviceName(capture_config_t* c
 }
 
 
+static CSimpleStringA generateCameraInfosJson(CSimpleStringA strEnv, CSimpleStringA strOpt, int iEnv, int iOpt, int iMtu)
+{
+	return CSimpleStringA::Format("[{\"EnvCamera\":\"%s\",\"OptCamera\":\"%s\",\"EnvRotate\":\"%d\",\"OptRotate\":\"%d\",\"mtu\":\"%d\"}]",
+		strEnv.GetData(), strOpt.GetData(), iEnv, iOpt, iMtu);
+}
+
 ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 {
 	CSmartPointer<IEntityFunction> spFunction = GetFunction();
@@ -1172,6 +1178,7 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 	strEwsCam = "$";
 	ErrorCodeEnum Error = spFunction->OpenConfig(Config_Root, spConfig);
 	if (Error == Error_Succeed) {
+		int imtu = 0;
 		table.AddEntryString("Audio", "handfree_in_dev", conf->strAudioIn, "$");
 		table.AddEntryString("Audio", "handfree_out_dev", conf->strAudioOut, "$");
 		table.AddEntryString("Video", "EnvCamera", conf->strVideoEnv, "$");
@@ -1181,9 +1188,14 @@ ErrorCodeEnum CMediaControllerEntity::LoadConfig(capture_config_t *conf)
 		table.AddEntryInt("Video", "OptRotate", conf->video_opt_rotate, 0);
 		table.AddEntryInt("Video", "EnvFps", conf->video_env_fps, 0);
 		table.AddEntryInt("Video", "OptFps", conf->video_opt_fps, 0);
+		table.AddEntryInt("Video", "mtu", imtu, 0);
 		Error = table.Load(spConfig);
 		if (Error == Error_Succeed)
 		{
+			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_ENV_CAMERA_INFO, conf->strVideoEnv.GetData());
+			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_MEDIACONTROLLER_OPT_CAMERA_INFO, conf->strVideoOpt.GetData());
+			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_CAMERA_INFOS, generateCameraInfosJson(conf->strVideoEnv, conf->strVideoOpt, conf->video_env_rotate, conf->video_opt_rotate, imtu).GetData());
+
 			char strInfo[MAX_PATH * 2] = { 0 };
 			Error = AutoGetVideoDeviceName(conf);
 			snprintf(strInfo, MAX_PATH * 2, "env = %s,opt = %s", conf->strVideoEnv.GetData(), conf->strVideoOpt.GetData());

+ 14 - 0
Module/mod_sipphone/Event.h

@@ -53,6 +53,20 @@
 
 #define EVENT_MOD_SIP_LOCAL_WINDOW_CREATE_FAILED		0x30190501	//创建本地图像渲染框失败
 #define EVENT_MOD_SIP_REMOTE_WINDOW_CREATE_FAILED		0x30190502  //创建远端图像渲染框失败
+#define EVENT_MOD_SIP_LOCAL_WINDOW_CREATE_SUCCESS		0x30190503	 //创建本地视频框成功
+#define EVENT_MOD_SIP_REMOTE_WINDOW_CREATE_SUCCESS		0x30190504   //创建远端视频框成功
+#define EVENT_MOD_SIP_LOCAL_WINDOW_DESTROY_SUCCESS		0x30190505	 //销毁本地视频框成功
+#define EVENT_MOD_SIP_REMOTE_WINDOW_DESTROY_SUCCESS		0x30190506   //销毁远端视频框成功
+
+#define EVENT_MOD_SIP_GET_CAMERA_INFO_FINISHED			0x30190513   //完成摄像头信息获取
+
+#define EVENT_MOD_SIP_AUDIO_DEVICE_INFO					0x30190521
+#define EVENT_MOD_SIP_AUDIO_VOLUME_INFO					0x30190522
+#define EVENT_MOD_SIP_AUDIO_DEVICE_CONFIG_ERROR			0x30190523
+#define EVENT_MOD_SIP_COREAUDIO_NOTMATCH_PORTAUDIO		0x30190524
+#define EVENT_MOD_SIP_AUDIO_IN_DEVICE_NOT_EXIST			0x30190525
+#define EVENT_MOD_SIP_AUDIO_OUT_DEVICE_NOT_EXIST		0x30190526
+
 #define EVENT_MOD_SIP_AUDIO_RTP_CREATE					0x30190001
 #define EVENT_MOD_SIP_AUDIO_RTP_DESTROY					0x30190002
 

+ 22 - 2
Module/mod_sipphone/mod_sipphone.cpp

@@ -1868,8 +1868,19 @@ void CSIPEntity::InitFreshTimeConfig()
 	LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_OVERWRITE_FRESHVALUE,
 			CSimpleStringA::Format("overwrite video freshtime from centersetting cache, left fresh time is %d, right fresh time is %d.", ileftvideo, irightvideo));
     m_ilocalvideo_freshtime = ileftvideo;
-	m_iremotevideo_freshtime = irightvideo;
-	
+	m_iremotevideo_freshtime = irightvideo;	
+}
+
+static CSimpleStringA generateAudioInfoJson(const char* handfreeIn, const char* handfreeOut, const char* pickupIn, const char* pickupOut)
+{
+	return CSimpleStringA::Format("[{\"handfree_in_dev\":\"%s\",\"handfree_out_dev\":\"%s\",\"pickup_in_dev\":\"%s\",\"pickup_out_dev\":\"%s\"}]",
+		handfreeIn, handfreeOut, pickupIn, pickupOut);
+}
+
+static CSimpleStringA generateVolumeJson(int ihandfreeIn, int ihandfreeOut, int ipickupIn, int ipickupOut)
+{
+	return CSimpleStringA::Format("[{\"handfree_in_volume\":\"%d\",\"handfree_out_volume\":\"%d\",\"pickup_in_volume\":\"%d\",\"pickup_out_volume\":\"%d\"}]",
+		ihandfreeIn, ihandfreeOut, ipickupIn, ipickupOut);
 }
 
 ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
@@ -1905,7 +1916,16 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 		table.AddEntryInt("video", "mtu", conf->mtu, 0);
 		Error = table.Load(spRootConfig);
 		if (Error == Error_Succeed) {
+			snprintf(conf->audio_handfree_in_dev, MAX_PATH, "%s", strHandFreeIn.GetData());
+			snprintf(conf->audio_handfree_out_dev, MAX_PATH, "%s", strHandFreeOut.GetData());
+			snprintf(conf->audio_pickup_in_dev, MAX_PATH, "%s", strPickupIn.GetData());
+			snprintf(conf->audio_pickup_out_dev, MAX_PATH, "%s", strPickupOut.GetData());
+
 			int id;
+			
+			LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_AUDIO_DEVICE_INFO, generateAudioInfoJson(conf->audio_handfree_in_dev, conf->audio_handfree_out_dev, conf->audio_pickup_in_dev, conf->audio_pickup_out_dev).GetData());
+			LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_AUDIO_VOLUME_INFO, generateVolumeJson(m_kept_volume_in[DEV_HANDFREE], m_kept_volume_out[DEV_HANDFREE], m_kept_volume_in[DEV_PICKUP], m_kept_volume_out[DEV_PICKUP]));
+
 #ifdef RVC_OS_WIN
 			id = capture_get_audio_device_id(true, strHandFreeIn);
 #else