Ver Fonte

Z991239-4157 #comment 解决远程双录存在视频回显失败问题

80274480 há 2 anos atrás
pai
commit
bb55c2fcc8

+ 5 - 5
Module/mod_assistantchannel/VideoDesc.h

@@ -51,7 +51,7 @@ static inline CSimpleStringA BuildVideoViewParam(int local_view_x, int local_vie
 static inline CSimpleStringA BuildVideoDesc(const char *remote_ip, int remote_video_rtp, int remote_video_width, int remote_video_height, int remote_video_fps, int local_view_x, int local_view_y, int local_view_cx, int local_view_cy, int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy)
 {
 	char param[512] = {0};
-	_snprintf(param, 512, 
+	snprintf(param, 512, 
 		"remote_ip:%s\r\n"
 		"remote_video_rtp:%d\r\n"
 		"remote_video_width:%d\r\n"
@@ -102,7 +102,7 @@ static inline ErrorCodeEnum ParseVideoDesc(const char *param, CSimpleStringA &re
 static inline CSimpleStringA BuildVideoRenderDesc(int local_view_x, int local_view_y, int local_view_cx, int local_view_cy)
 {
 	char param[512] = { 0 };
-	_snprintf(param, 512,
+	snprintf(param, 512,
 		"local_view_x:%d\r\n"
 		"local_view_y:%d\r\n"
 		"local_view_cx:%d\r\n"
@@ -118,7 +118,7 @@ static inline CSimpleStringA BuildVideoRenderDesc(int local_view_x, int local_vi
 static inline CSimpleStringA BuildDoubleVideoRenderDesc(int local_view_x, int local_view_y, int local_view_cx, int local_view_cy, int remote_view_x, int remote_view_y, int remote_view_cx, int remote_view_cy)
 {
 	char param[512] = { 0 };
-	_snprintf(param, 512,
+	snprintf(param, 512,
 		"local_view_x:%d\r\n"
 		"local_view_y:%d\r\n"
 		"local_view_cx:%d\r\n"
@@ -140,7 +140,7 @@ static inline CSimpleStringA ConstructVideoRenderParam(CSimpleStringA strMsg, bo
 	CSimpleStringA str;
 	if (false == bDoubleVideo) {
 		sscanf(strMsg.GetData(), "%d@%d@%d@%d@%s", &lxPos, &lyPos, &lwidth, &lheight, &str);
-		Dbg("local video param : (x=%d,y=%d,width=%d,height=%d).", lxPos, lyPos, lwidth, lheight);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("local video param : (x=%d,y=%d,width=%d,height=%d).", lxPos, lyPos, lwidth, lheight);
 		strVideoParam = BuildVideoRenderDesc(lxPos, lyPos, lwidth, lheight);
 	}
 	else {
@@ -156,7 +156,7 @@ static inline CSimpleStringA ConstructVideoRenderParam(CSimpleStringA strMsg, bo
 				}
 			}
 		}
-		Dbg("remote record local video param : (x=%d,y=%d,width=%d,height=%d), remote video param : (x=%d,y=%d,width=%d,height=%d)",
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("remote record local video param : (x=%d,y=%d,width=%d,height=%d), remote video param : (x=%d,y=%d,width=%d,height=%d)",
 			iPostionArr[0][0], iPostionArr[1][0], iPostionArr[2][0], iPostionArr[3][0], iPostionArr[0][1], iPostionArr[1][1], iPostionArr[2][1], iPostionArr[3][1]);
 		strVideoParam = BuildDoubleVideoRenderDesc(iPostionArr[0][0], iPostionArr[1][0], iPostionArr[2][0], iPostionArr[3][0], iPostionArr[0][1], iPostionArr[1][1], iPostionArr[2][1], iPostionArr[3][1]);
 	}

+ 1 - 1
Module/mod_assistantchannel/mod_assistantchannel.cpp

@@ -352,7 +352,7 @@ void CBizChannelEntity::ChangeState(int new_state, const char *param)
 }
 
 
-//void on_recv_pkt(int type, int sub_type, const char *pkt, int pkt_size)
+
 void CBizChannelEntity::on_recv_pkt(int type, int sub_type, int id, CBlob &data)
 {
 	//LOG_TRACE("rx pkt, %d bytes, type = %d, sub_type = %d, id = %d, hash = %d", data.m_iLength, type, sub_type, id, hash32_buf(data.m_pData, data.m_iLength, 0));

+ 6 - 6
Module/mod_counterconnector/ConnectorFSM.cpp

@@ -363,11 +363,11 @@ static int GetCallInfoFromConfig(char* strcallurl, size_t ucalllen, char* strass
 	char *result[MAX_VOIP_SERVER_NUM] = {0};
 	int icount = CStringSplit((char*)psrc, result, MAX_VOIP_SERVER_NUM, ",");
 	if(2 == icount){
-		_snprintf(strcallurl, ucalllen, "%s", result[0]);
+		snprintf(strcallurl, ucalllen, "%s", result[0]);
 		char *assitresult[MAX_VOIP_SERVER_NUM] = {0};
 		icount = CStringSplit(result[1], assitresult, MAX_VOIP_SERVER_NUM, " ");
 		if(2 == icount){
-			_snprintf(strassist, assitlen, "%s", assitresult[0]);
+			snprintf(strassist, assitlen, "%s", assitresult[0]);
 			*uport = atoi(assitresult[1]);
 			iRet = 0;
 		}
@@ -786,7 +786,7 @@ void ACMCallFSM::s8_on_entry()
 
 			if (icount > 1){
 				char strmsg[MAX_PATH] = {0};
-				_snprintf(strmsg, MAX_PATH, "request call route {%s:%d} %d times.", m_strCallRouteIP.GetData(), m_iCallRoutePort, icount);
+				snprintf(strmsg, MAX_PATH, "request call route {%s:%d} %d times.", m_strCallRouteIP.GetData(), m_iCallRoutePort, icount);
 				LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_TIMES, strmsg);
 			}
 		}
@@ -904,7 +904,7 @@ void ACMCallFSM::s11_on_entry()
 							m_strChanProxyIP[0] = strassistip;
 							m_strChanProxyIP[1] = strassistip;
 							char strmsg[MAX_PATH] = {0};
-							_snprintf(strmsg, MAX_PATH, "head office mode no more call router, use default config(call url is %s, assistip is %s).", strcallurl, strassistip);
+							snprintf(strmsg, MAX_PATH, "head office mode no more call router, use default config(call url is %s, assistip is %s).", strcallurl, strassistip);
 							LogWarn(Severity_Low, Error_Debug, LOG_WARN_COUNTERCONNECT_CALLROUTE_CONFIG, strmsg);
 						}
 					}
@@ -970,7 +970,7 @@ unsigned int ACMCallFSM::s11_on_event(FSMEvent* event)
 			DWORD now = GetTickCount();
 			int interval = now - m_nStarttime;
 			char msg[128] = {0};
-			_snprintf(msg, 128, "sip connecting, customer active hangup after %d ms.", interval);
+			snprintf(msg, 128, "sip connecting, customer active hangup after %d ms.", interval);
 			LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_COUNTERCONNECT_SIPCONNECT_HANGUP, msg);
 	}
 	else if (event->iEvt == USER_EVT_SIP_STATE_IDLE) 
@@ -1098,7 +1098,7 @@ unsigned int ACMCallFSM::s12_on_event(FSMEvent* event)
 		DWORD now = GetTickCount();
 		int interval = now - m_nStarttime;
 		char msg[128] = {0};
-		_snprintf(msg, 128, "chan connecting, customer active hangup after %d ms.", interval);
+		snprintf(msg, 128, "chan connecting, customer active hangup after %d ms.", interval);
 		LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_COUNTERCONNECT_CHANCONNECT_HANGUP, msg);
 	}
 	else if (event->iEvt == USER_EVT_SIP_STATE_IDLE) 

+ 7 - 7
Module/mod_counterconnector/ConnectorFSM.h

@@ -436,7 +436,7 @@ public:
 
 	ErrorCodeEnum StartVideoRender(const char* param)
 	{
-		Dbg("Start Record Video Render, and param is %s.", param);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Start Record Video Render, and param is %s.", param);
 		if (!m_pPhoneClient)
 			return Error_NetBroken;
 		PhoneService_StartVideoRender_Info Info;
@@ -445,21 +445,21 @@ public:
 			Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
 			Info.local_hwd_move = 0;
 			Info.remote_hwd_move = 1;
-		Dbg("start record video render,local(%d,%d,%d,%d),remote(%d,%d,%d,%d)",
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start record video render,local(%d,%d,%d,%d),remote(%d,%d,%d,%d)",
 			Info.local_view_x, Info.local_view_y, Info.local_view_cx, Info.local_view_cy,
 			Info.remote_view_x, Info.remote_view_y, Info.remote_view_cx, Info.remote_view_cy);
 		if (Error == Error_Succeed) {
 			Error = m_pPhoneClient->StartVideoRender(Info);
 		}
 		else {
-			Dbg("parse video desc failed!");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("parse video desc failed!");
 		}
 		return Error;
 	}
 
 	ErrorCodeEnum StopVideoRender()
 	{
-		Dbg("Stop Record Video Render");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Stop Record Video Render");
 		if (!m_pPhoneClient)
 			return Error_NetBroken;
 		return m_pPhoneClient->StopVideoRender();
@@ -569,7 +569,7 @@ private:
 		ifconf.ifc_len = 256;
 		ifconf.ifc_buf = strbuf;
 		if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-			Dbg("socket error");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("socket error");
 			return error;
 		}
 		ioctl(sockfd, SIOCGIFCONF, &ifconf); //get all socket info
@@ -577,13 +577,13 @@ private:
 		for (int i = (ifconf.ifc_len / sizeof(struct ifreq)); i > 0; i--) {
 			if (ifreq->ifr_flags == AF_INET) { //for ipv4
 				char* strIP = inet_ntoa(((struct sockaddr_in*) & (ifreq->ifr_addr))->sin_addr);
-				Dbg("name = %s, local addr = %s", ifreq->ifr_name, strIP);
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("name = %s, local addr = %s", ifreq->ifr_name, strIP);
 				ifreq++;
 				if (NULL != strIP) {
 					if (NULL == strstr(strIP, "198.168.") && NULL == strstr(strIP, "127.0.0.1"))
 					{
 						strcpy(buff, strIP);
-						Dbg("local ip == %s", buff);
+						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("local ip == %s", buff);
 						error = Error_Succeed;
 						break;
 					}

+ 3 - 8
Module/mod_counterconnector/mod_counterconnector.cpp

@@ -310,7 +310,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 				m_fsm.m_strHintCallNum = "";
 
 			}
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv UI call num = %s",m_fsm.m_strHintCallNum);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv UI call num = %s",m_fsm.m_strHintCallNum.GetData());
 			m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_HANDFREE_CALL));
 		} 
 		else
@@ -695,23 +695,18 @@ CSimpleStringA CCounterConnectorEntity ::ConstructVideoParam(CSimpleStringA strM
 
 void CCounterConnectorEntity::Handle_StartRecord(const char* pszMessage)
 {
-	// edit by ly@2019/04/18
 	CSimpleStringA strMsg = pszMessage;
-	if (strMsg.IsStartWith("ews|",true)){
-		strMsg = strMsg.SubString(4,strMsg.GetLength()-4);
-	}
 
 	CSimpleStringA strVideo;
-	strVideo = ConstructVideoParam(strMsg, false);						
+	strVideo = ConstructVideoRenderParam(strMsg, false);						
 	m_fsm.PostEventFIFO(new ShowLocalVideoEvent(strVideo));									// 非连坐席双录
 	m_bIsSalesRecord = TRUE;
 }
 
 void CCounterConnectorEntity::Handle_StartRemoteRecord(const char* pszMessage)
 {
-	// edit by ly@2019/04/18
 	CSimpleStringA strMsg = pszMessage;
-	CSimpleStringA strVideo = ConstructVideoParam(strMsg, true);
+	CSimpleStringA strVideo = ConstructVideoRenderParam(strMsg, true);
 	m_fsm.PostEventFIFO(new ShowLocalAndRemoteVideoEvent(strVideo));						// 连坐席双录
 	m_bIsRemoteRecord = TRUE;
 	m_bIsRemoteRecordStopSpeakerCapture = FALSE;

+ 9 - 9
Module/mod_customeraware/CustomerHandleFSM.cpp

@@ -53,14 +53,14 @@ void CCustomerHandleFSM::OnStateTrans( int iSrcState, int iDstState )
 			CSimpleStringA strSysVar;
 			GetEntityBase()->GetFunction()->GetSysVar("CustomerHandle", strSysVar);
 			char* strState = (char*)strSysVar.GetData();
-			Dbg("CustomerHandle is %s", strState);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CustomerHandle is %s", strState);
 			if ('N' != *strState){
 				int stateid = GetStateIdBySysState(strState);
 				PostEventFIFO(new FSMEvent(state_id_evt[stateid].evt_code));
 			}
 		}
 
-		Dbg("Sales Recording or other desktop type,ignore all event!");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Sales Recording or other desktop type,ignore all event!");
 	}
 
 }
@@ -71,11 +71,11 @@ ErrorCodeEnum CCustomerHandleFSM::SetSysState( int state )
 	if (*sts[state] != 'N' && *sts[nOldstate] == 'N') 
 	{
 		m_uid = CUUID::Create(m_uid);
-		Dbg("customeraware start new SessionID=%s",m_uid.ToString().GetData());
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("customeraware start new SessionID=%s",m_uid.ToString().GetData());
 		errCode = GetEntityBase()->GetFunction()->SetSysVar("SessionID",m_uid.ToString());
 		if (errCode != Error_Succeed)
 		{
-			Dbg("set SessionID failed (%d).",errCode);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set SessionID failed (%d).",errCode);
 		}
 		LogEvent(Severity_Middle, EVENT_MOD_CUSTOMERAWARE_BEGIN, m_uid.ToString());
 	} 
@@ -83,11 +83,11 @@ ErrorCodeEnum CCustomerHandleFSM::SetSysState( int state )
 	else if((state == s2 && *sts[state] == 'A' && *sts[nOldstate] == 'A')||(state == s5)) 
 	{
 		m_uid = CUUID::Create(m_uid);
-		Dbg("state(%d) current state name is %s, oldstate name is %s, new SessionID=%s",state, sts[state], sts[nOldstate], m_uid.ToString().GetData());
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("state(%d) current state name is %s, oldstate name is %s, new SessionID=%s",state, sts[state], sts[nOldstate], m_uid.ToString().GetData());
 		errCode = GetEntityBase()->GetFunction()->SetSysVar("SessionID",m_uid.ToString());
 		if (errCode != Error_Succeed)
 		{
-			Dbg("set SessionID failed (%d).",errCode);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set SessionID failed (%d).",errCode);
 		}
 	} 
 	else if (*sts[state] == 'N') 
@@ -98,15 +98,15 @@ ErrorCodeEnum CCustomerHandleFSM::SetSysState( int state )
 			//客户离开,清空sessionid
 			errCode = GetEntityBase()->GetFunction()->SetSysVar("SessionID","N");
 			if (errCode != Error_Succeed){
-				Dbg("customeraware end set SessionID to Null failed (%d).",errCode);
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("customeraware end set SessionID to Null failed (%d).",errCode);
 			}
 			else {
-				Dbg("customeraware end set SessionID to N success.", errCode);
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("customeraware end set SessionID to N success.", errCode);
 			}
 		}
 	}
 	nOldstate = state;
-	Dbg("SetsysVar CustomerHandle to %s",sts[state]);
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetsysVar CustomerHandle to %s",sts[state]);
 	return GetEntityBase()->GetFunction()->SetSysVar("CustomerHandle", sts[state]);
 }
 

+ 10 - 10
Module/mod_customeraware/mod_customeraware.cpp

@@ -76,7 +76,7 @@ public:
 			else
 			{
 				Func->GetSysVar(SYSVAR_DESKTOPTYPE, strValue);
-				Dbg("Desktop type is : %s",strValue.GetData());
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Desktop type is : %s",strValue.GetData());
 			}
 		}
 
@@ -122,20 +122,20 @@ public:
 		//是否进入客户经理录像
 		if (dwUserCode == LOG_EVT_UI_STARTRECORD || LOG_EVT_UI_STARTRECORDPREVIEW == dwUserCode)
 		{
-			Dbg("Enter sales record!");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter sales record!");
 			m_customerHandleFSM.m_bIsSalesRecord = TRUE;
 			m_customerHandleFSM.PostEventFIFO(new FSMEvent(USER_EVT_INTO_CUSTOMERRECORD));
 		} 
 		else if(LOG_EVT_UI_STARTREMOTERECORD == dwUserCode)
 		{
-			Dbg("Enter sales remote record!");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Enter sales remote record!");
 			m_customerHandleFSM.m_bIsSalesRecord = TRUE;
 			m_customerHandleFSM.PostEventFIFO(new FSMEvent(USER_EVT_INTO_CUSTOMERRECORD));
 		} 
 		//是否在客户经理录像的时候退出到了首页,进入有人接近状态
 		else if (dwUserCode == LOG_EVT_UI_RETURNMENU||dwUserCode == LOG_EVT_UI_EXITSALESRECORD)
 		{
-			Dbg("exit to main!");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("exit to main!");
 			if (m_customerHandleFSM.m_bIsSalesRecord)
 			{
 				m_customerHandleFSM.m_bIsSalesRecord = FALSE;
@@ -166,10 +166,10 @@ public:
 	{
 		if (_stricmp(pszKey, SYSVAR_DESKTOPTYPE) == 0)
 		{
-			Dbg("desktop type from : %c to %c", pszOldValue[0], pszValue[0]);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("desktop type from : %c to %c", pszOldValue[0], pszValue[0]);
 			//不再进入客户感知用户桌面状态,解决用户桌面态返回main页面问题
 			if (m_eDeviceType != eDesk2SType) {
-				Dbg("DeviceType:%d customeraware not go to USERDESKTOP state", m_eDeviceType);
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("DeviceType:%d customeraware not go to USERDESKTOP state", m_eDeviceType);
 				return;
 			}
 
@@ -187,7 +187,7 @@ public:
 			}
 			else
 			{
-				Dbg("unknown  desktop type!");
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown  desktop type!");
 			}
 		}
 		else if (_stricmp(pszKey,"CustomerID") == 0)
@@ -196,7 +196,7 @@ public:
 			GetFunction()->GetSysVar("CustomerID",strCustomerID);
 			if(_stricmp(strCustomerID,"N") == 0)
 			{
-				Dbg("CustomerID to N!");
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CustomerID to N!");
 			}
 			else
 			{
@@ -204,11 +204,11 @@ public:
 				{
 					//customerid改变生成新的sessionid
 					CUUID m_uid = CUUID::Create(m_uid);
-					Dbg("CustomerID change,generate new sessionID=%s",m_uid.ToString().GetData());
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CustomerID change,generate new sessionID=%s",m_uid.ToString().GetData());
 					ErrorCodeEnum  errCode = GetFunction()->SetSysVar("SessionID",m_uid.ToString());
 					if (errCode != Error_Succeed)
 					{
-						Dbg("set SessionID failed (%d).",errCode);
+						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set SessionID failed (%d).",errCode);
 					}
 				}
 			}

+ 14 - 8
Module/mod_mediacontroller/capture.cpp

@@ -1857,14 +1857,14 @@ namespace MediaController {
 			video_capture_stop(cap->env_video);
 			if (0 != cap->env_video->ustarttime) {
 				char strmsg[MAX_PATH] = { 0 };
-				_snprintf(strmsg, MAX_PATH, "stop envcam, and camera open time is %us.", y2k_time_now() - cap->env_video->ustarttime);
+				snprintf(strmsg, MAX_PATH, "stop envcam, and camera open time is %us.", y2k_time_now() - cap->env_video->ustarttime);
 				LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_ENVCAM_CLOSE, strmsg);
 			}
 		}
 		if (cap->opt_video) {
 			if (0 != cap->opt_video->ustarttime) {
 				char strinfo[MAX_PATH] = { 0 };
-				_snprintf(strinfo, MAX_PATH, "stop optcam, and camera open time is %us.", y2k_time_now() - cap->opt_video->ustarttime);
+				snprintf(strinfo, MAX_PATH, "stop optcam, and camera open time is %us.", y2k_time_now() - cap->opt_video->ustarttime);
 				LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_OPTCAM_CLOSE, strinfo);
 			}
 			video_capture_stop(cap->opt_video);
@@ -2469,9 +2469,12 @@ namespace MediaController {
 		if((nCamera == ENVCAMERA)&&cap->env_video)
 		{
 			video_capture_stop(cap->env_video);
-			char strmsg[MAX_PATH] = { 0 };
-			_snprintf(strmsg, MAX_PATH, "stop envcam, and camera open time is %us.", y2k_time_now() - cap->env_video->ustarttime);
-			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_ENVCAM_CLOSE, strmsg);
+			if (0 != cap->env_video->ustarttime) {
+				char strmsg[MAX_PATH] = { 0 };
+				snprintf(strmsg, MAX_PATH, "stop envcam, and camera open time is %us.", y2k_time_now() - cap->env_video->ustarttime);
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_ENVCAM_CLOSE, strmsg);
+			}
+
 			video_capture_destroy(cap->env_video);
 			cap->env_video = NULL;
 			return 0;
@@ -2479,9 +2482,12 @@ namespace MediaController {
 		else if((nCamera == OPTCAMERA)&&cap->opt_video)
 		{
 			video_capture_stop(cap->opt_video);
-			char strinfo[MAX_PATH] = { 0 };
-			_snprintf(strinfo, MAX_PATH, "stop optcam, and camera open time is %us.", y2k_time_now() - cap->opt_video->ustarttime);
-			LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_OPTCAM_CLOSE, strinfo);
+			if (0 != cap->opt_video->ustarttime) {
+				char strinfo[MAX_PATH] = { 0 };
+				snprintf(strinfo, MAX_PATH, "stop optcam, and camera open time is %us.", y2k_time_now() - cap->opt_video->ustarttime);
+				LogWarn(Severity_Low, Error_Debug, LOG_EVT_MEDIACONTROLLER_OPTCAM_CLOSE, strinfo);
+			}
+
 			video_capture_destroy(cap->opt_video);
 			cap->opt_video = NULL;
 			return 0;

+ 1 - 1
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -730,7 +730,7 @@ void CMediaControllerEntity::OnTimeCameraStatusCheck()
 		char strMessage[MAX_PATH*2] = {0};
 		get_camera_exception_message(strMessage, MAX_PATH*2, conf.strVideoOpt, "Opt camera bug detected!");
 		char strInfo[MAX_PATH*2] = {0};
-		_snprintf(strInfo, MAX_PATH*2, "%s and current time = %u, opt last capture time = %u, video queue LastOptTime = %u.",strMessage, y2k_time_now(), m_capture->opt_video->ulastcaptime, nLastOptTime);
+		snprintf(strInfo, MAX_PATH*2, "%s and current time = %u, opt last capture time = %u, video queue LastOptTime = %u.",strMessage, y2k_time_now(), m_capture->opt_video->ulastcaptime, nLastOptTime);
 		LogWarn(Severity_Middle, Error_Hardware, ERROR_MOD_MEDIACONTROLLER_OPECAMERA_BUG, strInfo);
 		if (m_nCameraErrorCode == Error_Succeed)
 		{

+ 2 - 1
Module/mod_sipphone/video_render.cpp

@@ -252,7 +252,7 @@ void* rvc_remote_videorender_func(void* arg)
 
 	Clibvideoqueue* video_shm_q_remote = new Clibvideoqueue(REC_COMMON_VIDEO_REMOTE_SHM_RTP_QUEUE);
 	
-	_snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
+	snprintf(strImgPath, MAX_PATH, "%s", "./bin/agent.jpg");
 
 	video_frame* remote_frame = video_frame_new(irecord_video_frame_width, irecord_video_frame_heigt, VIDEO_FORMAT_RGB24);
 	video_frame_fill_black(remote_frame);
@@ -260,6 +260,7 @@ void* rvc_remote_videorender_func(void* arg)
 	if (ExistsFile(strImgPath)){
 		IplImage* img = cvLoadImage(strImgPath, 1);
 		videoq_frame* vframe = new videoq_frame;
+
 		if (NULL != img) {
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("load img success");
 			vframe->format = VIDEOQ_FORMAT_RGB24;