ソースを参照

Z991239-2910 #comment [localmediaplayer] 优化连线告警信息

陈礼鹏80274480 3 年 前
コミット
b7ffbbacd6

+ 8 - 8
Module/mod_counterconnector/ConnectorFSM.cpp

@@ -72,7 +72,7 @@ public:
 				if (!m_bSipConnected){
 					char strmsg[MAX_PATH] = { 0 };
 					_snprintf(strmsg, MAX_PATH, "sip connect failed for %s.", Msg.status.GetData());
-					LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_SIP_CONNECT_FAILED,strmsg);
+					LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_SIP_CONNECT_FAILED,strmsg);
 				}
 			}
 		}
@@ -343,17 +343,17 @@ void ACMCallFSM::OnStateTrans(int iSrcState, int iDstState)
 				else{
 					char strinfo[MAX_PATH] = {0};
 					_snprintf(strinfo, MAX_PATH,"state from %d to %d, auto reconnect, not broadcast state to ui.", st1, st2);
-					LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_AUTO_RECONNECT,strinfo);
+					LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_AUTO_RECONNECT,strinfo);
 				}
 
 				if (eState_HandFree == st2 || eState_Pickup == st2){
 					if (eState_Connecting == st1){
-						LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_CONNECT_SUCCESS, "connect success!");
+						LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_CONNECT_SUCCESS, "connect success!");
 					}
 				}
 
 				if (eState_Fail == st1 && eState_Offline == st2){
-					LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_CONNECT_FAILED, "connect failed!");
+					LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_CONNECT_FAILED, "connect failed!");
 				}
 			}
 			SetCallState(st2);
@@ -406,14 +406,14 @@ unsigned int ACMCallFSM::s0_on_event(FSMEvent* event)
 		memset(&m_CallingParam,0,sizeof(m_CallingParam));  //正常呼叫
 		GetEntityBase()->GetFunction()->SetSysVar(SYSVAR_CALLTYPE, CALLTYPE_NORMAL); // 设置呼叫模式为常规呼叫
 		m_nSysCallType = 0;
-		LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_PICKUPCALL,"begin pickup call");
+		LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_PICKUPCALL,"begin pickup call");
 	} 
 	else if (event->iEvt == USER_EVT_HANDFREE_CALL) 
 	{
 		GetEntityBase()->GetFunction()->SetSysVar(SYSVAR_CALLTYPE,CALLTYPE_NORMAL); // 设置呼叫模式为常规呼叫
 		m_nSysCallType = 0;
 		memset(&m_CallingParam,0,sizeof(m_CallingParam));							// 正常呼叫
-		LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_HANDFREECALL,"begin hand free call");
+		LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_HANDFREECALL,"begin hand free call");
 	}
 	else if (event->iEvt == USER_EVT_COMMAND_CALL)
 	{
@@ -453,7 +453,7 @@ unsigned int ACMCallFSM::s0_on_event(FSMEvent* event)
 		//GetEntityBase()->GetFunction()->SetSysVar(SYSVAR_CALLTYPE,CALLTYPE_RECORD); // 设置呼叫模式为双录呼叫
 		m_nSysCallType = 0;
 		Dbg("start double record call,call type is %d.", m_CallingParam.nCallType);
-		LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_DOUBLERECORDCALL,"begin double record call");
+		LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_DOUBLERECORDCALL,"begin double record call");
 	}
 	else if (event->iEvt == USER_EVT_STOPLOACALREMOTEVIDEO) 
 	{
@@ -592,7 +592,7 @@ unsigned int ACMCallFSM::s10_on_event(FSMEvent* event)
 void ACMCallFSM::s11_on_entry() 
 {
 	ErrorCodeEnum Error = Error_Succeed;
-	LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_MAKECALL,"begin make call");
+	LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_MAKECALL,"begin make call");
 	if (m_nCurSipServer == Error_Server){
 		Error = Error_NetBroken;
 	}

+ 3 - 3
Module/mod_counterconnector/mod_counterconnector.cpp

@@ -792,11 +792,11 @@ void ChannelCounterConnectorClient::OnMessage(ErrorCodeEnum Error, ChannelServic
 			if (eChannelState_Connected == m_eLastState){
 				char strmsg[MAX_PATH] = {0};
 				_snprintf(strmsg, MAX_PATH, "call connected time is %us.", y2k_time_now() - m_uConnectTime);
-				LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_CALL_CONNECT_TIME, strmsg);
+				LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_CALL_CONNECT_TIME, strmsg);
 			}
 
 			if (eChannelState_Connecting == m_eLastState){
-				LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_ASSIST_CONNECT_FAILED,"make call failed for assistant channel connect failed!");
+				LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_ASSIST_CONNECT_FAILED,"make call failed for assistant channel connect failed!");
 			}
 		} 
 		else if (Msg.state == eChannelState_Connected) 
@@ -812,7 +812,7 @@ void ChannelCounterConnectorClient::OnMessage(ErrorCodeEnum Error, ChannelServic
 		else if(eChannelState_Closing == Msg.state){
 			Dbg("ChannelState is eChannelState_Closing");
 			if (eChannelState_Connecting == m_eLastState){
-				LogWarn(Severity_High, Error_Debug, LOG_WARN_COUNTERCONNECT_ASSIST_CONNECT_FAILED,"make call failed for assistant channel closed.");
+				LogWarn(Severity_Middle, Error_Debug, LOG_WARN_COUNTERCONNECT_ASSIST_CONNECT_FAILED,"make call failed for assistant channel closed.");
 			}
 		}
 

+ 2 - 2
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -451,7 +451,7 @@ int CLocalMediaPlayEntity::LoadPlayConfig(CPicPlayConfig& config, int CfgInx)
 
 void CLocalMediaPlayEntity::Debug(media_loglevel log_level, const char* fmt, ...)
 {
-	if (log_level >= MEDIA_LOG_ERROR){
+	if (log_level >= MEDIA_LOG_DEBUG){
 		va_list arg;
 		va_start(arg, fmt);
 		vDbg(fmt, arg);
@@ -533,7 +533,7 @@ int CLocalMediaPlayEntity::GetPlayerIcoPath(char* strPath, size_t uLen)
 
 	CSimpleStringA szIcoName("rvc_media_player_64px.bmp");
 	szIcoName = csBinPath + SPLIT_SLASH_STR + szIcoName;
-	if (m_bgetico) {
+	if (m_bgetico == false) {
 		Dbg("media player ico full path is %s.", szIcoName.GetData());
 		m_bgetico = true;
 	}

+ 5 - 4
Other/libmediaplayer/audio.cpp

@@ -358,20 +358,21 @@ static int open_audio_playing(void *arg)
 	wanted_spec.callback = sdl_audio_callback;          // 回调函数,若为NULL,则应使用SDL_QueueAudio()机制
     wanted_spec.userdata = is;                          // 提供给回调函数的参数
 	
-	if (NULL == strdevname) {
+	if (NULL == is->straudiodev) {
 		int iaudioapeaker = SDL_GetNumAudioDevices(0);
 		is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "audio output device number is %d.", iaudioapeaker);
 		int i = 0;
 		for (; i < iaudioapeaker; i++) {
 			is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "device id %d audio device name is %s.", i, SDL_GetAudioDeviceName(i, 0));
 			if (is->paudiodev && strstr(SDL_GetAudioDeviceName(i, 0), is->paudiodev)) {
-				strdevname = SDL_GetAudioDeviceName(i, 0);
+				const char* strdevname = SDL_GetAudioDeviceName(i, 0);
+				is->straudiodev = av_strdup(strdevname);
 				is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "%s matched audio device name is %s.", is->paudiodev, strdevname);
 				break;
 			}
 		}
 		if (i == iaudioapeaker) {
-			is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "matched audio device name (%s) failed!", strdevname ? strdevname : "null");
+			is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "matched audio device name (%s) failed!", is->straudiodev ? is->straudiodev : "null");
 		}
 
 		{
@@ -386,7 +387,7 @@ static int open_audio_playing(void *arg)
 		is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "current audio driver name is %s.", SDL_GetCurrentAudioDriver());
 	}
 
-	while (!(audio_dev = SDL_OpenAudioDevice(strdevname, 0, &wanted_spec, &actual_spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))){
+	while (!(audio_dev = SDL_OpenAudioDevice(is->straudiodev, 0, &wanted_spec, &actual_spec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE | SDL_AUDIO_ALLOW_CHANNELS_CHANGE))){
 		is->rvc_hostapi->Debug(MEDIA_LOG_ERROR, "SDL_OpenAudio (%d channels, %d Hz): %s",wanted_spec.channels, wanted_spec.freq, SDL_GetError());
 		if (!wanted_spec.channels) {
 			if (!wanted_spec.freq) {

+ 5 - 0
Other/libmediaplayer/player.cpp

@@ -355,6 +355,11 @@ int CMediaPlayer::UnInitialize_Player_Stat()
 		m_player_stat->paudiodev = NULL;
 	}
 
+	if (m_player_stat->straudiodev) {
+		av_free(m_player_stat->straudiodev);
+		m_player_stat->straudiodev = NULL;
+	}
+
 	av_free(m_player_stat);
 	m_player_stat = NULL;
 

+ 2 - 1
Other/libmediaplayer/player.h

@@ -226,6 +226,7 @@ typedef struct player_stat_s{
 	eMediaType_t eMType;			// 媒体类型
 	eWindType_t eWindType;			// 视频框大小类型
 	volatile uint8_t uVolume;		// 音量大小1-128
+	char* straudiodev;				// 获取到的音频设备名
 	CMediaHostApi* rvc_hostapi;
 	
 	char strPlayLists[MAX_FILECOUNT][MAX_PATH];		//播放列表,全路径
@@ -263,7 +264,7 @@ void set_clock_at(play_clock_t *c, double pts, int serial, double time);
 void set_clock(play_clock_t *c, double pts, int serial);
 
 static SDL_AudioDeviceID audio_dev;
-static const char* strdevname = NULL;
+
 class CMediaPlayer
 {
 public: