Pārlūkot izejas kodu

Z991239-4806 #comment 音频处理配置支持使用集中配置

80274480 2 gadi atpakaļ
vecāks
revīzija
1c135e75fc
28 mainītis faili ar 349 papildinājumiem un 356 dzēšanām
  1. 0 1
      Module/mod_agentip/mod_agentip.cpp
  2. 0 1
      Module/mod_assistantchannel/mod_assistantchannel.cpp
  3. 5 5
      Module/mod_counterconnector/mod_counterconnector.cpp
  4. 1 1
      Module/mod_countercontext/mod_countercontext.cpp
  5. 1 1
      Module/mod_evtconverter/mod_evtconverter.cpp
  6. 0 3
      Module/mod_facetracking/mod_facetracking.cpp
  7. 0 4
      Module/mod_initiativetransfer/FlowControlFSM.cpp
  8. 1 5
      Module/mod_initiativetransfer/mod_initiativetransfer.cpp
  9. 1 2
      Module/mod_interactioncontext/mod_interactioncontext.cpp
  10. 11 10
      Module/mod_interactivecontrol/mod_interactivecontrol.cpp
  11. 0 1
      Module/mod_interactivelog/mod_interactivelog.cpp
  12. 12 1
      Module/mod_livenessdetection/mod_livenessdetection.cpp
  13. 1 4
      Module/mod_localmediaplay/mod_localmediaplay.cpp
  14. 0 6
      Module/mod_localmediaplay/mod_localmediaplay.h
  15. 16 7
      Module/mod_mediacontroller/capture.cpp
  16. 2 3
      Module/mod_mediacontroller/mod_mediacontroller.cpp
  17. 1 1
      Module/mod_screenshot/mod_screenshot.cpp
  18. 3 3
      Module/mod_sipphone/Event.h
  19. 29 36
      Module/mod_sipphone/audio_session.cpp
  20. 66 80
      Module/mod_sipphone/endpoint.cpp
  21. 9 7
      Module/mod_sipphone/endpoint.h
  22. 171 154
      Module/mod_sipphone/mod_sipphone.cpp
  23. 3 12
      Module/mod_sipphone/mod_sipphone.h
  24. 12 3
      Module/mod_sipphone/video_session.cpp
  25. 1 1
      Module/mod_snapshot/mod_snapshot.cpp
  26. 1 1
      Other/libaudiomgr/linux/core_time.cpp
  27. 1 2
      Other/libaudiomgr/linux/libaudiomgr_linux.cpp
  28. 1 1
      Other/libvideoframework/video_statics/video_stats.c

+ 0 - 1
Module/mod_agentip/mod_agentip.cpp

@@ -233,7 +233,6 @@ void CamSwitchChannelClient::OnMessage(ErrorCodeEnum Error, ChannelService_State
 
 void CamSwitchChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	LOG_FUNCTION();
 	if (Error == Error_Succeed) {
 		CAgentInterpreterEntity *pEntity = static_cast<CAgentInterpreterEntity*>(m_pEntityBase);
 		pEntity->SwitchCamera(Msg.sub_type);

+ 0 - 1
Module/mod_assistantchannel/mod_assistantchannel.cpp

@@ -182,7 +182,6 @@ ErrorCodeEnum CBizChannelEntity::__OnClose(ErrorCodeEnum preOperationError)
 	
 CServerSessionBase* CBizChannelEntity::OnNewSession(const char* pszRemoteEntityName, const char * pszClass)
 {
-	LOG_FUNCTION();
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s connected class = %s!", pszRemoteEntityName, pszClass);
 	return new ChannelServiceSession(this, m_id_seq++);
 }

+ 5 - 5
Module/mod_counterconnector/mod_counterconnector.cpp

@@ -114,7 +114,7 @@ void CCounterConnectorEntity::OnStarted()
 		}
 	}
 	
-	Sleep(500);
+	usleep(500*1000);
 
 	m_pCounterConnectorChannel = new ChannelCounterConnectorClient(this);
 	if (Error_Succeed == ConnectAssistChannel()){
@@ -128,7 +128,7 @@ void CCounterConnectorEntity::OnStarted()
 		GetFunction()->SetTimer(2, this, 3900);
 	}
 
-	Sleep(500);
+	usleep(500*1000);
 
 	if (m_fsm.ReConnectionSipphone()){
 		m_fsm.m_bConSipphone = TRUE;
@@ -472,7 +472,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 	case LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS:		
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current state name is %s.", m_fsm.GetCurrStateName());
-		Sleep(500);
+		usleep(500*1000);
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_ASSISTCHAN_IDEL));
 		m_fsm.m_bConAssist = FALSE;
 		GetFunction()->SetTimer(2, this, 3900);
@@ -496,7 +496,7 @@ void CCounterConnectorEntity ::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUI
 
 	case LOG_EVT_MOD_SIPPHONE_STARTED_SUCCESS: 
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_SIPPHONE_STARTED_SUCCESS");
-		Sleep(890);
+		usleep(890*1000);
 		m_fsm.PostEventFIFO(new FSMEvent(USER_EVT_SIPPHONE_IDEL));
 		m_fsm.m_bConSipphone = FALSE;
 		GetFunction()->SetTimer(3, this, 3700);
@@ -1045,7 +1045,7 @@ void CCounterConnectorSession::Handle_SetVideoCallRouteParams(SpReqAnsContext<Co
 
 void CCounterConnectorSession::OnClose(ErrorCodeEnum eErrorCode )
 {
-	LOG_FUNCTION();
+
 }
 
 SP_BEGIN_ENTITY_MAP()

+ 1 - 1
Module/mod_countercontext/mod_countercontext.cpp

@@ -47,7 +47,7 @@ public:
 		if (LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS == dwUserCode)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(900);
+			usleep(900*1000);
 			if (m_pChannelClient != NULL){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Close AssistChannel Session ");
 				m_pChannelClient->GetFunction()->CloseSession();

+ 1 - 1
Module/mod_evtconverter/mod_evtconverter.cpp

@@ -23,7 +23,7 @@ public:
 	{
 		if (m_nIslog)
 		{
-			LOG_FUNCTION();
+
 		}
 		//MessageBoxA(0,0,0,0);
 		m_eDeviceType = eStand2sType;  //add by chh

+ 0 - 3
Module/mod_facetracking/mod_facetracking.cpp

@@ -48,7 +48,6 @@ public:
 
 	virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext) 
 	{
-		LOG_FUNCTION();
 		CSmartPointer<IEntityFunction> spFunction = GetFunction();
 		ErrorCodeEnum Error;
 		BOOL bRet = FALSE;
@@ -141,7 +140,6 @@ public:
 
 	virtual void OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITransactionContext> pTransactionContext) 
 	{ 
-		LOG_FUNCTION();
 		CSmartPointer<IEntityFunction> spFunction = GetFunction();
 		spFunction->KillTimer(1); // if timer 1 not exist also ok
 		delete m_facecapture;
@@ -512,7 +510,6 @@ private:
 
 void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	LOG_FUNCTION();
 	if (Error == Error_Succeed) 
 	{
 		CFaceTrackingEntity *pEntity = static_cast<CFaceTrackingEntity*>(m_pEntityBase);

+ 0 - 4
Module/mod_initiativetransfer/FlowControlFSM.cpp

@@ -5,7 +5,6 @@
 
 void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_State_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	LOG_FUNCTION();
 	if (Error == Error_Succeed) {
 		if (Msg.state == eChannelState_Connected) {
 			m_pFSM->PostEventFIFO(new FSMEvent(USER_EVT_CHAN_ON));
@@ -17,7 +16,6 @@ void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_State_Info &M
 
 void ChannelClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	LOG_FUNCTION();
 	if (Error == Error_Succeed) {
 		m_pFSM->ProcessPacket(Msg.sub_type, Msg.data);
 	}
@@ -377,7 +375,6 @@ ErrorCodeEnum CFlowControlFSM::SetState(const char *s, const char *sdesc)
 
 ErrorCodeEnum CFlowControlFSM::DisallowControl()
 {
-	LOG_FUNCTION();
 	if (m_pClient) {
 		ChannelService_Send_Info Info;
 		Info.compress = false;
@@ -393,6 +390,5 @@ ErrorCodeEnum CFlowControlFSM::DisallowControl()
 
 void NotifyEnterFlowEvent::OnUnhandled()
 {
-	LOG_FUNCTION();
 	m_pFSM->DisallowControl();
 }

+ 1 - 5
Module/mod_initiativetransfer/mod_initiativetransfer.cpp

@@ -103,7 +103,7 @@ public:
 		if (dwUserCode == LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(1000);
+			sleep(1);
 			m_fsm->PostEventFIFO(new FSMEvent(USER_EVT_ASSIS_IDEL));
 		}
 		else if (dwUserCode == LOG_EVT_UI_RETURNMENU)
@@ -115,7 +115,6 @@ public:
 
 	virtual CServerSessionBase *OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszClass*/)
 	{
-		LOG_FUNCTION();
 		return new FlowControlServiceSession(this);
 	}
 
@@ -154,19 +153,16 @@ private:
 
 void FlowControlServiceSession::Handle_SwitchToAgentFlow( SpOnewayCallContext<FlowService_SwitchToAgentFlow_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	m_pEntity->SwitchToAgentFlow(ctx->Info.req_context);
 }
 
 void FlowControlServiceSession::Handle_DisallowControl( SpOnewayCallContext<FlowService_DisallowControl_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	m_pEntity->DisallowControl();
 }
 
 void FlowControlServiceSession::Handle_ReturnAgent( SpOnewayCallContext<FlowService_ReturnAgent_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	m_pEntity->ReturnAgent(ctx->Info.ans_context);
 }
 

+ 1 - 2
Module/mod_interactioncontext/mod_interactioncontext.cpp

@@ -103,7 +103,7 @@ public:
 		if (dwUserCode == LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS.");
-			Sleep(900);
+			sleep(1);
 			if (m_pChannelClient != NULL){
 				m_pChannelClient->GetFunction()->CloseSession();
 				m_pChannelClient->SafeDelete();
@@ -246,7 +246,6 @@ public:
 			{
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cur calltype cannot send pkt");
 			}
-
 		}
 	}
 

+ 11 - 10
Module/mod_interactivecontrol/mod_interactivecontrol.cpp

@@ -1060,7 +1060,7 @@ void CITCtrlEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,co
 	case LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS:
 		{
 			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(310);
+			usleep(310*1000);
 			if (m_pChannelClient!=NULL){
 				m_pChannelClient->GetFunction()->CloseSession();
 				m_pChannelClient = NULL;
@@ -1081,7 +1081,7 @@ void CITCtrlEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,co
 	case LOG_EVT_MOD_MEDIACONTROLLER_STARTED_SUCCESS:
 		{
 			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_MEDIACONTROLLER_STARTED_SUCCESS.");
-			Sleep(370);
+			usleep(370*1000);
 			if (m_pMediaCtlClient != NULL) {
 				m_pMediaCtlClient->GetFunction()->CloseSession();
 				m_pMediaCtlClient = NULL;
@@ -1107,7 +1107,7 @@ void CITCtrlEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,co
 	case LOG_EVT_MOD_LOCALPLAYER_STARTED_SUCCESS:
 		{
 			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_LOCALPLAYER_STARTED_SUCCESS.");
-			Sleep(300);
+			usleep(300*1000);
 			if (m_pPlayClient!=NULL){
 				m_pPlayClient->GetFunction()->CloseSession();
 				m_pPlayClient = NULL;
@@ -1132,7 +1132,7 @@ void CITCtrlEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,co
 	case LOG_EVT_MOD_SALESRECORDER_STARTED_SUCCESS:
 		{
 			//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_SALESRECORDER_STARTED_SUCCESS.");
-			Sleep(350);
+			usleep(350*1000);
 			if (m_pSalesRecordClient != NULL) {
 				m_pSalesRecordClient->GetFunction()->CloseSession();
 				m_pSalesRecordClient = NULL;
@@ -1160,7 +1160,7 @@ void CITCtrlEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,co
 			if (m_bSalesRecording) {
 				OnSalesRecordingFailed("[RTA3L09] 检测到系统异常,录像时视频回显失败,请重新录制");
 			}
-			Sleep(330);
+			usleep(330*1000);
 			if (m_pSipPhoneClient != NULL) {
 				m_pSipPhoneClient->GetFunction()->CloseSession();
 				m_pSipPhoneClient = NULL;
@@ -1801,8 +1801,10 @@ ErrorCodeEnum CITCtrlEntity::StartTransactionRecord(CSimpleStringA strVideoName)
 
 ErrorCodeEnum CITCtrlEntity::StopTransactionRecord(CSimpleStringA strVideoName)
 {
+	char strmsg[MAX_PATH] = { 0 };
 	if (!IsRecordEntityAvailable()) {
-		LogWarn(Severity_Middle, Error_Debug, LOG_EVT_STOP_TRANSACTIONRECORD_FAILED, "stop transaction record failed for connect RecordClient failed!");
+		snprintf(strmsg, MAX_PATH, "stop transaction record %s failed for connect RecordClient failed!", strVideoName.GetData());
+		LogWarn(Severity_Middle, Error_Debug, LOG_EVT_STOP_TRANSACTIONRECORD_FAILED, strmsg);
 		return Error_DevConnFailed;
 	}
 
@@ -1811,11 +1813,11 @@ ErrorCodeEnum CITCtrlEntity::StopTransactionRecord(CSimpleStringA strVideoName)
 	req.VideoName = strVideoName;
 	ErrorCodeEnum rc = m_pRecordClient->StopTransactionRecord(req, ans, 5000);
 	if (Error_Succeed == rc) {
-		LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_TRANSACTIONRECORD_SUCCESS, "stop transaction record success.");
+		snprintf(strmsg, MAX_PATH, "stop transaction record %s success.", strVideoName.GetData());
+		LogWarn(Severity_Low, Error_Debug, LOG_EVT_STOP_TRANSACTIONRECORD_SUCCESS, strmsg);
 	}
 	else {
-		char strmsg[MAX_PATH] = { 0 };
-		snprintf(strmsg, MAX_PATH, "stop transaction record failed for 0x%08x.", rc);
+		snprintf(strmsg, MAX_PATH, "stop transaction record %s failed for 0x%08x.", strVideoName.GetData(), rc);
 		LogWarn(Severity_Middle, Error_Debug, LOG_EVT_STOP_TRANSACTIONRECORD_FAILED, strmsg);
 	}
 
@@ -1884,7 +1886,6 @@ void UIServiceSession::Handle_SendAgentText( SpReqAnsContext<UIService_SendAgent
 
 void UIServiceSession::Handle_SetMenuTree( SpOnewayCallContext<UIService_SetMenuTree_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	m_pEntity->SetMenuTree(ctx->Info.content);
 }
 

+ 0 - 1
Module/mod_interactivelog/mod_interactivelog.cpp

@@ -182,7 +182,6 @@ public:
 
 	virtual CServerSessionBase *OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszParam*/)
 	{
-		LOG_FUNCTION();
 		return new ServerSession(this);
 	}
 

+ 12 - 1
Module/mod_livenessdetection/mod_livenessdetection.cpp

@@ -245,7 +245,18 @@ void CLivenessDetectionEntity::Debug( const char *fmt, ... )
 {
 	va_list arg;
 	va_start(arg, fmt);
-	vDbg(fmt, arg);
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_PATH) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_PATH] = { 0 };
+		vsnprintf(strlog, MAX_PATH, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
+	}
 	va_end(arg);
 }
 

+ 1 - 4
Module/mod_localmediaplay/mod_localmediaplay.cpp

@@ -155,7 +155,6 @@ void CLocalMediaPlayEntity::setMediaPath()
 
 CServerSessionBase* CLocalMediaPlayEntity::OnNewSession(const char* pszRemoteEntityName, const char * pszClass)
 {
-	LOG_FUNCTION();
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s connected class = %s!", pszRemoteEntityName, pszClass);
 	return new CLocalMediaPlaySession(this, m_id_seq++);
 }
@@ -699,7 +698,6 @@ void CLocalMediaPlayEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID n
 
 void CLocalMediaPlayEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
 {
-	LOG_FUNCTION();
 	ErrorCodeEnum Error = __OnStart(Error_Succeed);
 	pTransactionContext->SendAnswer(Error);
 }
@@ -774,7 +772,6 @@ void CLocalMediaPlayEntity::OnStarted()
 
 void CLocalMediaPlayEntity::OnPreClose(EntityCloseCauseEnum eCloseCause, CSmartPointer<ITransactionContext> pTransactionContext)
 {
-	LOG_FUNCTION();
 	ErrorCodeEnum Error = __OnClose(Error_Succeed);
 	pTransactionContext->SendAnswer(Error);
 }
@@ -1774,7 +1771,7 @@ void CLocalMediaPlaySession::Handle_StopPlayImage(SpReqAnsContext<PlayService_St
 
 void CLocalMediaPlaySession::OnClose(ErrorCodeEnum)
 {
-	LOG_FUNCTION();
+
 }
 
 void CLocalMediaPlaySession::Handle_GetLocalVideoVolume( SpReqAnsContext<PlayService_GetLocalVideoVolume_Req, PlayService_GetLocalVideoVolume_Ans>::Pointer ctx )

+ 0 - 6
Module/mod_localmediaplay/mod_localmediaplay.h

@@ -23,7 +23,6 @@
 
 
 //#include "SpTest.h"
-#include "modVer.h"
 #include "EventCode.h"
 
 
@@ -62,10 +61,6 @@ typedef struct {
 	int nWndHeight;
 }MediaPlayParam;
 
-//DWORD WINAPI qryMedia(LPVOID lpv);
-//DWORD WINAPI MediaPlayThread(LPVOID param);
-//DWORD WINAPI clearOutdata(LPVOID lpv);
-//DWORD WINAPI CheckAudioThread(LPVOID param);
 
 #ifdef RVC_OS_WIN
 class CLocalMediaPlayEntity : public CWmpHostApi, public CImgHostApi, public CEntityBase, public ILogListener
@@ -164,7 +159,6 @@ protected:
 #endif // RVC_OS_WIN
 
 private:
-
 	virtual void OnSelfTest(EntityTestEnum eTestType, CSmartPointer<ITransactionContext> pTransactionContext);
 
 	// 按分隔符分隔字符串

+ 16 - 7
Module/mod_mediacontroller/capture.cpp

@@ -6,6 +6,7 @@
 #include "../../Other/libvideohorflip/videohorflip.h"
 #include "../../Other/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h"
 #else
+#include <unistd.h>
 #endif // RVC_OS_WIN
 
 #include <locale.h>
@@ -670,8 +671,6 @@ static void record_audio_data_callback(const void* input, unsigned long audiolen
 
 static int record_pulseaudio_capture_start(rvc_audio_capture_t* audio_cap)
 {
-	LOG_FUNCTION();
-	
 	int iret = -1;
 
 	rvc_sales_audio_capture_t* cap = audio_cap->parent;
@@ -1366,7 +1365,18 @@ static int video_capture_start_win(video_capture_t* video_cap)
 
 static void __videocaplog(void* user_data, const char* fmt, va_list arg)
 {
-	vDbg(fmt, arg);
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_PATH) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_PATH] = { 0 };
+		vsnprintf(strlog, MAX_PATH, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
+	}
 }
 
 static void   __logevent(int itype, const char* strmessage)
@@ -1384,7 +1394,6 @@ static void   __logevent(int itype, const char* strmessage)
 
 static int video_capture_start_linux(video_capture_t* video_cap)
 {
-	LOG_FUNCTION();
 	int iret = -1;
 	capture_config_t* conf = &video_cap->parent->config;
 	int dev_id = -1;
@@ -1690,7 +1699,7 @@ namespace MediaController {
 				{
 					if (cap->env_video) 
 					{
-						::Sleep(3000);
+						sleep(1);
 					}
 					rc = video_capture_start(cap->opt_video);
 					if (rc != Error_Succeed) 
@@ -1724,7 +1733,7 @@ namespace MediaController {
 				{
 					if (cap->env_video) 
 					{
-						::Sleep(3000);
+						sleep(1);
 					}
 					rc = video_capture_start(cap->opt_video);
 					if (rc != Error_Succeed) 
@@ -1756,7 +1765,7 @@ namespace MediaController {
 			{
 				if (cap->env_video) 
 				{
-					::Sleep(3000);
+					sleep(1);
 				}
 				rc = video_capture_start(cap->opt_video);
 				if (rc != Error_Succeed) 

+ 2 - 3
Module/mod_mediacontroller/mod_mediacontroller.cpp

@@ -1360,7 +1360,7 @@ void CMediaControllerEntity::OnLog( const CAutoArray<CUUID> &SubIDs, const CUUID
 	case  LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS:
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(800);
+			usleep(800*1000);
 			if (m_pMediaControllerChannel != NULL){
 				m_pMediaControllerChannel->GetFunction()->CloseSession();
 				m_pMediaControllerChannel = NULL;
@@ -1768,7 +1768,7 @@ ErrorCodeEnum CMediaControllerEntity::ReStartCamera(int nCamera)
 		else {
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ReStartCamera %d,stop camera success!", nCamera);
 		}
-		Sleep(2000);
+		sleep(2);
 			
 		ErrorCodeEnum Error = Error_Succeed;
 		Error = capture_create(&conf, m_capture,nCamera);
@@ -2074,7 +2074,6 @@ void ChannelMediaControllerClient::OnMessage(ErrorCodeEnum Error, ChannelService
 
 void ChannelMediaControllerClient::OnMessage( ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData )
 {
-	LOG_FUNCTION();
 	if (Error == Error_Succeed) 
 	{
 		CMediaControllerEntity *pEntity = static_cast<CMediaControllerEntity*>(m_pEntityBase);

+ 1 - 1
Module/mod_screenshot/mod_screenshot.cpp

@@ -128,7 +128,7 @@ public:
 		if (dwUserCode == LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(970);
+			usleep(970*1000);
 			if (NULL != m_pChannelClient){
 				m_pChannelClient->GetFunction()->CloseSession();
 				m_pChannelClient = NULL;

+ 3 - 3
Module/mod_sipphone/Event.h

@@ -50,9 +50,8 @@
 #define ERROR_MOD_SIP_HANDFREE_ADDVOLUMNFAIL			0x30180170  //免提加强音量失败,级别2	
 #define ERROR_MOD_SIP_HANDFREE_REDUCEVOLUMNFAIL			0x30180171  //免提恢复音量失败,级别2
 
-
-#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_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	 //销毁本地视频框成功
@@ -68,6 +67,7 @@
 #define EVENT_MOD_SIP_AUDIO_OUT_DEVICE_NOT_EXIST		0x30190526
 #define EVENT_MOD_SIP_AUDIO_CONFIG_AUTO_CORRECT			0x30190527
 #define EVENT_MOD_SIP_AUDIO_DSP_INFO					0x30190528
+#define EVENT_MOD_SIP_CENTER_AUDIO_DSP_FLAGS			0x30190529
 
 #define EVENT_MOD_SIP_AUDIO_RTP_CREATE					0x30190001
 #define EVENT_MOD_SIP_AUDIO_RTP_DESTROY					0x30190002

+ 29 - 36
Module/mod_sipphone/audio_session.cpp

@@ -499,7 +499,6 @@ static int execute_cmd_return_result(const char* cmd, char* result)
 
 static int phonemedia_start(audio_session_t *session)
 {
-	LOG_FUNCTION();
 	audio_session_t *media = session;
 	audio_session_phonemedia_conf_t *conf = &media->phonemedia_conf;
 	apr_status_t status;
@@ -898,13 +897,16 @@ static int phonemedia_chang_dev(audio_session_t *session, e_dev_type t)
 		}
 		apr_pool_destroy(media->micspk_pool);
 		apr_pool_create(&media->micspk_pool, media->pool);
-		if (in_agc)
+		if (in_agc) {
 			opt_micspk |= AMS2_OPT_AGC;
-		if (in_ns)
+		}
+		if (in_ns) {
 			opt_micspk |= AMS2_OPT_NS;
-		if (aec)
+		}
+		if (aec) {
 			opt_micspk |= AMS2_OPT_AEC;
-
+		}
+			
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start audiomicspk_create");
 #ifdef RVC_OS_WIN
 		audiomicspk2_create(media->micspk_pool, media->engine, opt_micspk, AUDIO_CLOCK, in_dev, out_dev, &media->micspkstream);
@@ -925,10 +927,12 @@ static int phonemedia_chang_dev(audio_session_t *session, e_dev_type t)
 		if (out_agc || out_ns) {
 			int read_opt = AUDIO_DSP_NONE;
 			int write_opt = AUDIO_DSP_NONE;
-			if (out_agc)
+			if (out_agc) {
 				write_opt |= AUDIO_DSP_AGC;
-			if (out_ns)
+			}
+			if (out_ns) {
 				write_opt |= AUDIO_DSP_DENOISE;
+			}
 			audiodsp_create(media->micspk_pool, media->engine, read_opt, write_opt, AUDIO_CLOCK, &media->dspstream);		
 		}
 		if (conf->dir == DIR_TX) {
@@ -944,7 +948,8 @@ static int phonemedia_chang_dev(audio_session_t *session, e_dev_type t)
 		else if (conf->dir == DIR_RX) {
 			if (media->dspstream) {
 				audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->micspkstream->base, &media->dspstream->base, NULL);
-			} else {
+			} 
+			else {
 				audiostream_connect_pipeline(STREAM_DIR_WRITE, &media->micspkstream->base, NULL);
 			}
 			audiostream_connect_pipeline(STREAM_DIR_READ, &media->resizestream->base, &media->codecstream->base, &media->rtpstream->base, NULL);
@@ -954,7 +959,8 @@ static int phonemedia_chang_dev(audio_session_t *session, e_dev_type t)
 		else {
 			if (media->dspstream) {
 				audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->micspkstream->base, &media->dspstream->base, NULL);
-			} else {
+			} 
+			else {
 				audiostream_connect_pipeline(STREAM_DIR_BOTH, &media->micspkstream->base, NULL);
 			}
 			audiobridge_set_leg(media->bridge, AUDIO_BRIDGE_LEG_LEFT, &media->micspkstream->base);
@@ -967,38 +973,29 @@ static int phonemedia_chang_dev(audio_session_t *session, e_dev_type t)
 		audiocontext_add_driver(media->context, &media->bridge->base);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("phonemedia_chang_dev start audiocontext_add_driver success");
 		return 0;
-	} else {
+	} 
+	else {
 		return Error_NotInit;
 	}
 	
 	return Error_Unexpect;
 }
 
-//static int phonemedia_start_remote_recording(audio_session_t *session, const audio_session_remote_recording_conf_t *conf)
-//{
-//	audio_session_t *media = session;
-//	if (!media->record.state) {
-//		media->record.state = TRUE;
-//		memcpy(&media->record.conf, conf, sizeof(audio_session_remote_recording_conf_t));
-//		if (media->pool) {
-//			int rc = phonemedia_on_remote_recording(media);
-//			if (rc != 0) {
-//				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start remote recording failed!");
-//			}
-//			return rc;
-//		}
-//		return 0;
-//	} else {
-//		return Error_Duplication;
-//	}
-//}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-//// audio session
 
 static void __audionslog(void* user_data, const char* fmt, va_list arg)
 {
-	vDbg(fmt, arg);
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_PATH) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_PATH] = { 0 };
+		vsnprintf(strlog, MAX_PATH, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
+	}
 }
 
 
@@ -1052,7 +1049,6 @@ int audio_session_create(const audio_session_conf_t *conf, audio_session_t **p_s
 int audio_session_start_phonemedia(audio_session_t *session, const audio_session_phonemedia_conf_t *conf)
 {
 	int rc;
-	LOG_FUNCTION();
 	if (!session)
 		return Error_NotInit;
 	if (session->pool) { // already started
@@ -1073,7 +1069,6 @@ int audio_session_change_dev(audio_session_t *session, e_dev_type t)
 }
 int audio_session_stop(audio_session_t *session)
 {
-	LOG_FUNCTION();
 	return phonemedia_stop(session, TRUE);
 }
 void audio_session_destroy(audio_session_t *session)
@@ -1111,7 +1106,6 @@ static void __stdcall __audio_log_func(int level, const char *s)
 
 int audio_lib_init()
 {
-	LOG_FUNCTION();
 	audio_log_set_func(&__audio_log_func);
 	int rc = audioframework_init();
 
@@ -1145,7 +1139,6 @@ int audio_lib_init()
 
 void audio_lib_deinit()
 {
-	LOG_FUNCTION();
 	audioframework_term();
 }
 

+ 66 - 80
Module/mod_sipphone/endpoint.cpp

@@ -190,12 +190,12 @@ static const char* call_type_table[] = {
 static void endpoint_media_change_audio_dev(endpoint_call_t *call, e_dev_type current_dev_type)
 {
 	if (call->audio) {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin audio_session_change_dev %d", current_dev_type);
+		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin audio_session_change_dev %d", current_dev_type);
 		char strmsg[MAX_PATH] = { 0 };
 		snprintf(strmsg, MAX_PATH, "change audio device to %s mode.", DEV_PICKUP == current_dev_type ? "pickup" : "hand free");
 		LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_AUDIO_DEVICE_SWITCH, strmsg);
 		audio_session_change_dev(call->audio, current_dev_type);
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("end audio_session_change_dev");
+		//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("end audio_session_change_dev");
 	}
 }
 
@@ -208,7 +208,6 @@ static __inline struct in_addr __lton(unsigned long ip)
 
 static void endpoint_media_update_video(endpoint_call_t *call, media_desc_t *video_desc, rvc_video_render_callback_t* cb)
 {
-	LOG_FUNCTION();
 	if (video_desc->media_dir == DIR_NONE) 
 	{
 		if (call->video) 
@@ -223,26 +222,24 @@ static void endpoint_media_update_video(endpoint_call_t *call, media_desc_t *vid
 		int rc;
 		endpoint_conf_t *ep_conf = &call->ep->conf;
 
-		if (!call->audio)
-		{
+		if (!call->audio){
 			audio_session_conf_t conf = {0};
 			strcpy(&conf.in_dev[DEV_PICKUP][0], ep_conf->audio_pickup_in_dev);
 			strcpy(&conf.in_dev[DEV_HANDFREE][0], ep_conf->audio_handfree_in_dev);
 			strcpy(&conf.out_dev[DEV_PICKUP][0], ep_conf->audio_pickup_out_dev);
 			strcpy(&conf.out_dev[DEV_HANDFREE][0], ep_conf->audio_handfree_out_dev);
-			conf.agc_in[DEV_PICKUP] = !!ep_conf->audio_pickup_in_agc;
-			conf.agc_in[DEV_HANDFREE] = !!ep_conf->audio_handfree_in_agc;
-			conf.agc_out[DEV_PICKUP] = !!ep_conf->audio_pickup_out_agc;
-			conf.agc_out[DEV_HANDFREE] = !!ep_conf->audio_handfree_out_agc;
-			conf.ns_in[DEV_PICKUP] = !!ep_conf->audio_pickup_in_ns;
-			conf.ns_in[DEV_HANDFREE] = !!ep_conf->audio_handfree_in_ns;
-			conf.ns_out[DEV_PICKUP] = !!ep_conf->audio_pickup_out_ns;
-			conf.ns_out[DEV_HANDFREE] = !!ep_conf->audio_handfree_out_ns;
-			conf.aec[DEV_PICKUP] = !!ep_conf->audio_pickup_aec;
-			conf.aec[DEV_HANDFREE] = !!ep_conf->audio_handfree_aec;
+			conf.agc_in[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_in_agc;
+			conf.agc_in[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_in_agc;
+			conf.agc_out[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_out_agc;
+			conf.agc_out[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_out_agc;
+			conf.ns_in[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_in_ns;
+			conf.ns_in[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_in_ns;
+			conf.ns_out[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_out_ns;
+			conf.ns_out[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_out_ns;
+			conf.aec[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_aec;
+			conf.aec[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_aec;
 			rc = audio_session_create(&conf, &call->audio);
-			if (rc != 0) 
-			{
+			if (rc != 0) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create audio session failed! rc = %d", rc);
 				return;
 			}
@@ -296,7 +293,7 @@ static void endpoint_media_update_video(endpoint_call_t *call, media_desc_t *vid
 			return;
 		}
 		else{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("make remote call session addr is 0x%08x.",call->video);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("make remote call session addr is 0x%08x.",call->video);
 		}
 		rc = video_session_start(call->video);
 		if (rc != 0) {
@@ -306,44 +303,43 @@ static void endpoint_media_update_video(endpoint_call_t *call, media_desc_t *vid
 			return;
 		}
 		else{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("endpoint media update video, video session start suc, and session is 0x%08x.", call->video);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("endpoint media update video, video session start success, and session is 0x%08x.", call->video);
 		}
 	}
 }
 
 static void endpoint_media_update_audio(endpoint_call_t *call, media_desc_t *audio_desc, int dev_type)
 {
-	LOG_TRACE("audio dir:%d", audio_desc->media_dir);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("audio dir:%d", audio_desc->media_dir);
 	if (audio_desc->media_dir == DIR_NONE) {
 		if (call->audio) {
-			LOG_TRACE("stop audio...");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop audio...");
 			audio_session_stop(call->audio);
 			audio_session_destroy(call->audio);
 			call->audio = NULL;
-			LOG_TRACE("stop audio ok!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop audio ok!");
 		}
 		else{
-			LOG_TRACE("call->audio is null.");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call->audio is null.");
 		}
-
 		if (call->video) { // close video also 
-			LOG_TRACE("stop video...");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop video...");
 			video_session_stop(call->video);
 			video_session_destroy(call->video);
 			call->video = NULL;
-			LOG_TRACE("stop video ok!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop video ok!");
 		}
 		else{
-			LOG_TRACE("call->video is null.");
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call->video is null.");
 		}
 	} else {
 		int rc;
 		if (call->audio) {
-			LOG_TRACE("stop audio...");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop audio...");
 			audio_session_stop(call->audio);
 			audio_session_destroy(call->audio);
 			call->audio = NULL;
-			LOG_TRACE("stop audio ok!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("stop audio ok!");
 		}
 		if (!call->audio) {
 			endpoint_conf_t *ep_conf = &call->ep->conf;
@@ -352,16 +348,16 @@ static void endpoint_media_update_audio(endpoint_call_t *call, media_desc_t *aud
 			strcpy(&conf.in_dev[DEV_HANDFREE][0], ep_conf->audio_handfree_in_dev);
 			strcpy(&conf.out_dev[DEV_PICKUP][0], ep_conf->audio_pickup_out_dev);
 			strcpy(&conf.out_dev[DEV_HANDFREE][0], ep_conf->audio_handfree_out_dev);			
-			conf.agc_in[DEV_PICKUP] = !!ep_conf->audio_pickup_in_agc;
-			conf.agc_in[DEV_HANDFREE] = !!ep_conf->audio_handfree_in_agc;
-			conf.agc_out[DEV_PICKUP] = !!ep_conf->audio_pickup_out_agc;
-			conf.agc_out[DEV_HANDFREE] = !!ep_conf->audio_handfree_out_agc;
-			conf.ns_in[DEV_PICKUP] = !!ep_conf->audio_pickup_in_ns;
-			conf.ns_in[DEV_HANDFREE] = !!ep_conf->audio_handfree_in_ns;
-			conf.ns_out[DEV_PICKUP] = !!ep_conf->audio_pickup_out_ns;
-			conf.ns_out[DEV_HANDFREE] = !!ep_conf->audio_handfree_out_ns;
-			conf.aec[DEV_PICKUP] = !!ep_conf->audio_pickup_aec;
-			conf.aec[DEV_HANDFREE] = !!ep_conf->audio_handfree_aec;
+			conf.agc_in[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_in_agc;
+			conf.agc_in[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_in_agc;
+			conf.agc_out[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_out_agc;
+			conf.agc_out[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_out_agc;
+			conf.ns_in[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_in_ns;
+			conf.ns_in[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_in_ns;
+			conf.ns_out[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_out_ns;
+			conf.ns_out[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_out_ns;
+			conf.aec[DEV_PICKUP] = !!ep_conf->audio_dsp.audio_pickup_aec;
+			conf.aec[DEV_HANDFREE] = !!ep_conf->audio_dsp.audio_handfree_aec;
 			rc = audio_session_create(&conf, &call->audio);
 			if (rc != 0) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("create audio session failed! rc = %d", rc);
@@ -392,7 +388,7 @@ static void endpoint_media_update_audio(endpoint_call_t *call, media_desc_t *aud
 		{
 			char strmsg[MAX_PATH] = {0};
 			snprintf(strmsg, MAX_PATH, "start audio session failed! rc = %d.", rc);
-			LogWarn(Severity_Low, Error_Debug, ERROR_MOD_SIP_AUDIO_INITFAIL, strmsg);
+			LogWarn(Severity_Middle, Error_Debug, ERROR_MOD_SIP_AUDIO_INITFAIL, strmsg);
 			audio_session_destroy(call->audio);
 			call->audio = NULL;
 			return;
@@ -435,7 +431,7 @@ static const char *call_make_offer(endpoint_call_t *call, char *buf, int size)
 	int need;
 	const char *fmt;
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("make call offer,device type is %s, Call Type is %s.", Device_Type_Table[call->eDeviceType], call_type_table[call->nCallType]);
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("make call offer,device type is %s, Call Type is %s", Device_Type_Table[call->eDeviceType], call_type_table[call->nCallType]);
 	if ((eMobilePadType == call->eDeviceType) || (ePadtype == call->eDeviceType)||(eDesk2SType == call->eDeviceType)||(eDesk1SType==call->eDeviceType)||(eDesk2SIntegratedType==call->eDeviceType)) //pad
 	{
 		if(call->nCallType == NORMAL_CALLTYPE || call->nCallType == DOUBLERECORD_CALLTYPE)//如果是可视柜台模式以及外拓版
@@ -494,7 +490,7 @@ static const char *call_make_offer(endpoint_call_t *call, char *buf, int size)
 #endif
 			//"a=inactive\r\n" //for debug only
 			;
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("pad site != CMB.FLB");
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("pad site != CMB.FLB");
 	}
 	
 	need = _scprintf(fmt, call->local_ip, local_audio_rtp_port);
@@ -771,9 +767,9 @@ static void negotiate_sdp(endpoint_call_t *call, const sdp_session_t *local_sdp,
 			call->sdpvieo_desc.remote_rtp_ip = video_desc.remote_ip;
 			call->sdpvieo_desc.remote_rtp_port = video_desc.remote_port;
 			call->last_media_desc_hash = hash_code;
-			char strmsg[MAX_PATH] = {0};
-			snprintf(strmsg, MAX_PATH, "negotiate video success!local video ip=%s port=%d pt=%d,remote video ip=%s port=%d pt=%d",str_local,video_desc.local_port,video_desc.local_pt,str_remote,video_desc.remote_port,video_desc.remote_pt);
-			LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_CALL_VIDEO_NEGOTIATE, strmsg);
+			//char strmsg[MAX_PATH] = {0};
+			//snprintf(strmsg, MAX_PATH, "negotiate video success!local video ip=%s port=%d pt=%d,remote video ip=%s port=%d pt=%d",str_local,video_desc.local_port,video_desc.local_pt,str_remote,video_desc.remote_port,video_desc.remote_pt);
+			//LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_CALL_VIDEO_NEGOTIATE, strmsg);
 		}
 	}
 	else
@@ -965,8 +961,8 @@ void terminatedcall(endpoint_call_t *call)
 {
 	int st = TERMINATED;
 	g_IsExternalTerminalted = TRUE;
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("g_IsExternalTerminalted = TRUE");
-	LOG_TRACE("terminated! by timeout!");
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("g_IsExternalTerminalted = TRUE");
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("terminated! by timeout!");
 	{
 		media_desc_t audio_desc = {0};
 		audio_desc.media_dir = DIR_NONE;
@@ -993,7 +989,7 @@ static void endpoint_callback(nua_event_t   event,
 				if (hmagic == NULL) {
 					handle_invite(status, phrase, nua, (endpoint_t*)magic, nh, (endpoint_call_t*)hmagic, sip, tags);
 				} else {
-					LOG_TRACE("reinvite!");
+					DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("reinvite!");
 					handle_reinvite(status, phrase, nua, (endpoint_t*)magic, nh, (endpoint_call_t*)hmagic, sip, tags);
 				}
 				break;
@@ -1004,11 +1000,11 @@ static void endpoint_callback(nua_event_t   event,
 
 			case nua_i_bye:
 				//.....
-				LOG_TRACE("nua_i_bye");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_i_bye");
 				break;
 
 			case nua_i_info:
-				LOG_TRACE("nua_i_info");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_i_info");
 				break;
 
 			case nua_i_state:
@@ -1016,7 +1012,7 @@ static void endpoint_callback(nua_event_t   event,
 				break;
 
 			case nua_i_active:
-				LOG_TRACE("nua_i_active");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_i_active");
 				break;
 
 			case nua_i_options:
@@ -1025,19 +1021,19 @@ static void endpoint_callback(nua_event_t   event,
 				break;
 
 			case nua_r_cancel:
-				LOG_TRACE("nua_r_cancel");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_r_cancel");
 				if (status > 300) {
 					nua_bye(nh, TAG_END());
 				}
 				break;
 			case nua_i_prack:
-				LOG_TRACE("nua_i_prack");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_i_prack");
 			case nua_r_prack:
-				LOG_TRACE("nua_r_prack");
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("nua_r_prack");
 				break;
 
 			case nua_r_bye:
-				LOG_TRACE("nua_r_bye");
+				//LOG_TRACE("nua_r_bye");
 				if (status > 300) {
 					nua_bye(nh, TAG_END());
 				}
@@ -1046,12 +1042,12 @@ static void endpoint_callback(nua_event_t   event,
 
 	default:
 		if (status > 100) { /* unknown event -> print out error message */
-		LOG_TRACE("unknown event %d: %03d %s.",
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown event %d: %03d %s.",
 			event,
 			status,
 			phrase);
 		} else {
-			LOG_TRACE("unknown event %d.", event);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unknown event %d.", event);
 		}
 		break;
 	}
@@ -1211,7 +1207,6 @@ static int __endpoint_start(endpoint_t *ep)
 
 static void __endpoint_stop(endpoint_t *ep)
 {
-	LOG_FUNCTION();
 #ifdef RVC_OS_WIN
 	if (ep->event_thread)
 	{
@@ -1283,17 +1278,19 @@ int endpoint_invoke(endpoint_t *ep, int (*func)(void*), void *user_data, int *re
 
 void endpoint_change_audio_dev(endpoint_t *ep, int dev_type)
 {
-	if (ep->curr_audio_dev_type != dev_type) {
-		ep->curr_audio_dev_type = dev_type;
-		if (ep->active_call) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("begin invoke media change audio device!");
-			endpoint_media_change_audio_dev(ep->active_call, (e_dev_type)dev_type);
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("end invoke media change audio device!");
+	if (ep){
+		if (ep->curr_audio_dev_type != dev_type) {
+			ep->curr_audio_dev_type = dev_type;
+			if (ep->active_call) {
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin invoke media change audio device!");
+				endpoint_media_change_audio_dev(ep->active_call, (e_dev_type)dev_type);
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("end invoke media change audio device!");
+			} else {
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("active call is null!");
+			}
 		} else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("active call is null!");
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("current dev_type is the same as dev_type!");
 		}
-	} else {
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("current dev_type is the same as dev_type!");
 	}
 }
 
@@ -1373,14 +1370,12 @@ int endpoint_call_start(endpoint_call_t *call)
 			SIPTAG_FROM_STR(call->from_uri),
 			SIPTAG_TO_STR(call->to_uri),
 			TAG_END());
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call from_uri is %s.", call->from_uri);
 	} else if (call->from_uri != NULL){
 		call->nh = nua_handle(call->ep->nua, 
 			call,
 			SIPTAG_FROM_STR(call->from_uri),
 			SIPTAG_TO_STR(call->to_uri),
 			TAG_END());
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call from_uri is %s.", call->from_uri);
 	}else if (call->call_id != NULL){
 		call->nh = nua_handle(call->ep->nua, 
 			call,
@@ -1388,18 +1383,14 @@ int endpoint_call_start(endpoint_call_t *call)
 			SIPTAG_CALL_ID_STR(call->call_id),
 			SIPTAG_TO_STR(call->to_uri),
 			TAG_END());
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call from_uri is %s.", call->ep->conf.uri);
 	}else{
 		call->nh = nua_handle(call->ep->nua, 
 			call,
 			SIPTAG_FROM_STR(call->ep->conf.uri),
 			SIPTAG_TO_STR(call->to_uri),
 			TAG_END());
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call from_uri is %s.", call->ep->conf.uri);
 	}
 
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("call to_uri is %s.", call->to_uri);
-	
 	call_make_offer(call, sdp, -1);
 
 	nua_invite(call->nh, 
@@ -1409,8 +1400,6 @@ int endpoint_call_start(endpoint_call_t *call)
 		//SOATAG_AUDIO_AUX("telephone-event"), 
 		TAG_END());
 
-	LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_INVITE_SEND, sdp);
-
 	return 0;
 }
 
@@ -1429,7 +1418,6 @@ int endpoint_call_hangup(endpoint_call_t *call)
 
 int endpoint_call_start_video(endpoint_call_t* call, endpoint_call_param_t* pcallparam, rvc_video_render_callback_t* render_cb)
 {
-	LOG_FUNCTION();
 	char local_ip_str[RVC_MAX_IP_LEN]={0};
 	char remtote_ip_str[RVC_MAX_IP_LEN]={0};
 	
@@ -1480,8 +1468,7 @@ int endpoint_call_start_video(endpoint_call_t* call, endpoint_call_param_t* pcal
 		translate_ipaddr_from_int(str_local_ip, RVC_MAX_IP_LEN,video_desc.local_ip);
 		translate_ipaddr_from_int(str_remtote_ip, RVC_MAX_IP_LEN, video_desc.remote_ip);
 
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start video,local video ip=%s port=%d pt=%d,remote ip=%s port=%d pt=%d",str_local_ip,video_desc.local_port,video_desc.local_pt,str_remtote_ip,video_desc.remote_port,video_desc.remote_pt);
-		
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start video,local video ip=%s port=%d pt=%d,remote ip=%s port=%d pt=%d",str_local_ip,video_desc.local_port,video_desc.local_pt,str_remtote_ip,video_desc.remote_port,video_desc.remote_pt);
 		return 0;
 	} 
 	else 
@@ -1493,7 +1480,6 @@ int endpoint_call_start_video(endpoint_call_t* call, endpoint_call_param_t* pcal
 
 int endpoint_call_stop_video(endpoint_call_t *call)
 {
-	LOG_FUNCTION();
 	if (call) {
 		media_desc_t video_desc = {0};
 		video_desc.media_dir = DIR_NONE;
@@ -1507,7 +1493,7 @@ int endpoint_call_stop_video(endpoint_call_t *call)
 
 static void __endpoint_call_destroy(endpoint_call_t *call)
 {
-	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("endpoint call destroy! home ref:%d", su_home_refcount(call->home));
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("endpoint call destroy! home ref:%d", su_home_refcount(call->home));
 	list_del(&call->entry);
 	if (call->ep->active_call == call) {
 		call->ep->active_call = NULL;

+ 9 - 7
Module/mod_sipphone/endpoint.h

@@ -29,13 +29,7 @@ enum e_call_state
 	TERMINATED,
 };
 
-
-typedef struct endpoint_conf_t {
-	char audio_handfree_in_dev[MAX_PATH];
-	char audio_handfree_out_dev[MAX_PATH];
-	char audio_pickup_in_dev[MAX_PATH];
-	char audio_pickup_out_dev[MAX_PATH];
-
+typedef struct endpoint_audiodsp_config_s {
 	bool audio_pickup_in_agc;
 	bool audio_pickup_out_agc;
 	bool audio_handfree_in_agc;
@@ -48,6 +42,14 @@ typedef struct endpoint_conf_t {
 
 	bool audio_pickup_aec;
 	bool audio_handfree_aec;
+}endpoint_audiodsp_config_t;
+
+typedef struct endpoint_conf_t {
+	char audio_handfree_in_dev[MAX_PATH];
+	char audio_handfree_out_dev[MAX_PATH];
+	char audio_pickup_in_dev[MAX_PATH];
+	char audio_pickup_out_dev[MAX_PATH];
+	endpoint_audiodsp_config_t audio_dsp;
 
 	int mtu;
 	int quant;

+ 171 - 154
Module/mod_sipphone/mod_sipphone.cpp

@@ -44,7 +44,7 @@
 #endif
 
 #ifndef RVC_VIDEO_FRESH_TIME
-#define RVC_VIDEO_FRESH_TIME 50
+#define RVC_VIDEO_FRESH_TIME 100
 #endif // !RVC_VIDEO_FRESH_TIME
 
 #ifndef RVC_MAX_VIDEO_FRESH_TIME
@@ -56,8 +56,6 @@
 #endif // !RVC_MAX_VIDEO_FRESH_TIME
 
 extern BOOL g_IsExternalTerminalted;
-extern BOOL g_bIsSalesRecord;
-extern BOOL g_bEwsRecord;
 
 
 static void __on_video_box_move(int imessagetype, int ivideotype, int ileft, int ibottom, void *user_data)
@@ -67,12 +65,6 @@ static void __on_video_box_move(int imessagetype, int ivideotype, int ileft, int
 }
 
 
-CSIPPhoneSession::CSIPPhoneSession(CSIPEntity *pEntity) : m_pEntity(pEntity), m_pCall(NULL), m_iLastState(0)
-{
-
-}
-
-
 static void __on_call_state(int state, const char *state_desc, const char *phrase, void *user_data)
 {
 	CSIPPhoneSession *pThis = static_cast<CSIPPhoneSession*>(user_data);
@@ -112,7 +104,6 @@ static int __control_video(void *arg)
 
 static int __video_render(void* arg)
 {
-	LOG_FUNCTION();
 	VideoRenderCommand_t* pCmd = (VideoRenderCommand_t*)(arg);
 	pCmd->pSIPPhoneSession->video_render(pCmd);
 	delete pCmd;
@@ -131,9 +122,21 @@ static int __release_call(void *user_data)
 
 static void __video_render_log(void* user_data, const char* fmt, va_list arg)
 {
-	vDbg(fmt, arg);
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_PATH) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_PATH] = { 0 };
+		vsnprintf(strlog, MAX_PATH, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
+	}
 }
 
+
 static int __on_stop_remote_video_render_callback(void* user_data)
 {
 	int iret = -1;
@@ -147,6 +150,7 @@ static int __on_stop_remote_video_render_callback(void* user_data)
 	return iret;
 }
 
+
 static int __remote_video_render_callback(void* videoframe, void* user_data)
 {
 	CSIPEntity* pThis = static_cast<CSIPEntity*>(user_data);
@@ -154,12 +158,60 @@ static int __remote_video_render_callback(void* videoframe, void* user_data)
 	return rvc_remote_video_render(pThis->m_render, videoframe);
 }
 
+
 static int __on_window_type_callback(void* user_data)
 {
 	CSIPEntity* pThis = static_cast<CSIPEntity*>(user_data);
 	return pThis->m_stVideoParam.bShowPersonArea;
 }
 
+
+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);
+}
+
+
+static CSimpleStringA generateAudioDspFlags(endpoint_audiodsp_config_t conf)
+{
+	int ipickup_in_agc = 0;
+	int ipickup_out_agc = 0;
+	int ihandfree_in_agc = 0;
+	int ihandfree_out_agc = 0;
+
+	int ipickup_in_ns = 0;
+	int ipickup_out_ns = 0;
+	int ihandfree_in_ns = 0;
+	int ihandfree_out_ns = 0;
+
+	int ipickup_aec = 0;
+	int ihandfree_aec = 0;
+
+	conf.audio_pickup_in_agc ? ipickup_in_agc = 1 : ipickup_in_agc = 0;
+	conf.audio_pickup_out_agc ? ipickup_out_agc = 1 : ipickup_out_agc = 0;
+	conf.audio_handfree_in_agc ? ihandfree_in_agc = 1 : ihandfree_in_agc = 0;
+	conf.audio_handfree_out_agc ? ihandfree_out_agc = 1 : ihandfree_out_agc = 0;
+	conf.audio_pickup_in_ns ? ipickup_in_ns = 1 : ipickup_in_ns = 0;
+	conf.audio_pickup_out_ns ? ipickup_out_ns = 1 : ipickup_out_ns = 0;
+	conf.audio_handfree_in_ns ? ihandfree_in_ns = 1 : ihandfree_in_ns = 0;
+	conf.audio_handfree_out_ns ? ihandfree_out_ns = 1 : ihandfree_out_ns = 0;
+	conf.audio_pickup_aec ? ipickup_aec = 1 : ipickup_aec = 0;
+	conf.audio_handfree_aec ? ihandfree_aec = 1 : ihandfree_aec = 0;
+
+	return CSimpleStringA::Format("{\"handfree_in_agc\":\"%d\",\"handfree_out_agc\":\"%d\",\"pickup_in_agc\":\"%d\",\"pickup_out_agc\":\"%d\",\"handfree_in_ns\":\"%d\",\"handfree_out_ns\":\"%d\",\"pickup_in_ns\":\"%d\",\"pickup_out_ns\":\"%d\",\"handfree_aec\":\"%d\",\"pickup_aec\":\"%d\"}",
+		ihandfree_in_agc, ihandfree_out_agc, ipickup_in_agc, ipickup_out_agc,
+		ihandfree_in_ns, ihandfree_out_ns, ipickup_in_ns, ipickup_out_ns,
+		ihandfree_aec, ipickup_aec);
+}
+
+
 CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhoneState(ePickupMicrophoneState_Off) 
 {
 	m_kept_volume_in[0] = m_kept_volume_in[1] = 0;
@@ -174,6 +226,7 @@ CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhone
 	m_ilocalvideo_freshtime = RVC_VIDEO_FRESH_TIME;
 	m_iremotevideo_freshtime = RVC_VIDEO_FRESH_TIME;
 	m_render = NULL;
+	m_iAudioDspUseCenter = 0;
 }
 
 
@@ -187,7 +240,7 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 	case LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS:
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(810);
+			usleep(810*1000);
 			if (m_pSipphoneChannel != NULL){
 				m_bConnectedAssist = FALSE;
 				m_pSipphoneChannel->GetFunction()->CloseSession();
@@ -345,7 +398,6 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start sales record video.");
 			m_bIsSalesRecord = TRUE;
-			g_bIsSalesRecord = m_bIsSalesRecord;
 		}
 		break;
 
@@ -362,7 +414,6 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop sales record video.");
 			m_bIsSalesRecord = FALSE;
-			g_bIsSalesRecord = m_bIsSalesRecord;
 			if (m_stVideoParam.bShowRecordArea){
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("stop sales record and stop preview.");
 				m_stVideoParam.bShowRecordArea = 0;
@@ -382,7 +433,6 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("return menu");
 			m_bIsSalesRecord = FALSE;
-			g_bIsSalesRecord = m_bIsSalesRecord;
 		}
 		break;
 
@@ -660,7 +710,6 @@ ErrorCodeEnum CSIPEntity::__OnStart(ErrorCodeEnum preOperationError)
 	m_stVideoParam.bActiveInspect = 0;
 	m_stVideoParam.bShowActiveImg = 0;
 	m_bIsSalesRecord = FALSE;
-	g_bIsSalesRecord = m_bIsSalesRecord;
 	m_stVideoParam.nWindowState = 0;
 	m_RecordVideoLocation.x = 0;
 	m_RecordVideoLocation.y = 0;
@@ -672,8 +721,7 @@ ErrorCodeEnum CSIPEntity::__OnStart(ErrorCodeEnum preOperationError)
 	endpoint_init_lib();
 
 	Error = GetLocalIP();
-	if (Error != 0) 
-	{
+	if (Error != 0) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get local ip failed!");
 		CSimpleStringA strErrMsg = "获取本地 IP 地址失败,请检查本地网络是否连接!";
 		LogWarn(Severity_Middle, Error_NetBroken, ERROR_MOD_SIP_GET_LOCAL_IP_FAILED, strErrMsg);
@@ -683,10 +731,14 @@ ErrorCodeEnum CSIPEntity::__OnStart(ErrorCodeEnum preOperationError)
 #ifdef RVC_OS_LINUX
 	RvcGetAudioDeviceInfo();
 #endif
+	if (Error_Succeed == LoadEntityConfig()) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("LoadEntityConfig success, and audio dsp use centersetting flag is %d.",m_iAudioDspUseCenter);
+		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.", m_ilocalvideo_freshtime, m_iremotevideo_freshtime).GetData());
+	}
 
 	Error = LoadConfig(&conf);
-	if (Error != Error_Succeed) 
-	{
+	if (Error != Error_Succeed) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("load config failed!");
 		return Error;
 	}
@@ -1534,17 +1586,13 @@ void CSIPEntity::OnPreClose(EntityCloseCauseEnum eCloseCause,CSmartPointer<ITran
 
 ErrorCodeEnum CSIPEntity::__OnClose(ErrorCodeEnum preOperationError)
 {
-	LOG_FUNCTION();
-
-	int i;
-
 	CSmartPointer<IEntityFunction> Func = GetFunction();
 	Func->UnregistSysVarEvent(SYSVAR_AGENTCAMERASWITCH);
 	Func->UnregistSysVarEvent(SYSVAR_ACTIVETRACKINGCAMERA);
 	Func->UnregistSysVarEvent(SYSVAR_CAMERASTATE);
 	Func->UnregistSysVarEvent(SYSVAR_CALLTYPE);
 		
-	for (i = 0; i < m_arrListener.GetCount(); ++i) {
+	for (int i = 0; i < m_arrListener.GetCount(); ++i) {
 		Func->UnsubscribeLog(m_arrListener[i]);
 	}
 	m_arrListener.Clear();
@@ -1622,7 +1670,6 @@ void CSIPEntity::OnContinued()
 
 CServerSessionBase*	CSIPEntity::OnNewSession(const char* /*pszRemoteEntityName*/, const char * /*pszClass*/)
 {
-	LOG_FUNCTION();
 	m_pCurrentSession = new CSIPPhoneSession(this);
 	return m_pCurrentSession;
 }
@@ -1711,8 +1758,6 @@ static int __change_dev(void *arg)
 
 void CSIPEntity::SwitchHandFree()
 {
-	LOG_FUNCTION();
-
 	int rc = 0;
 	ChangeDevCommand *pCmd = new ChangeDevCommand();
 	pCmd->pEntity = this;
@@ -1726,8 +1771,6 @@ void CSIPEntity::SwitchHandFree()
 
 void CSIPEntity::SwitchPickup()
 {
-	LOG_FUNCTION();
-
 	int rc = 0;
 	ChangeDevCommand *pCmd = new ChangeDevCommand();
 	pCmd->pEntity = this;
@@ -1829,99 +1872,6 @@ void CSIPEntity::Handle_AdjustVideoEchoEvent(const char* pszMessage)
 }
 
 
-void CSIPEntity::InitFreshTimeConfig()
-{
-	int ileftvideo = RVC_MAX_VIDEO_FRESH_TIME;
-	int irightvideo = RVC_MAX_VIDEO_FRESH_TIME;
-
-    CSmartPointer<IConfigInfo> spCacheConfig;
-	ErrorCodeEnum Error = GetFunction()->OpenConfig(Config_CenterSetting, spCacheConfig);
-	if (Error_Succeed == Error){
-		SpIniMappingTable table;
-		table.AddEntryInt("SIPPhone", "lfreshtime", ileftvideo, RVC_MAX_VIDEO_FRESH_TIME);
-		table.AddEntryInt("SIPPhone", "rfreshtime", irightvideo, RVC_MAX_VIDEO_FRESH_TIME);
-		Error = table.Load(spCacheConfig);
-		if (Error == Error_Succeed) {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("lfreshtime = %d, rfreshtime = %d.", ileftvideo, irightvideo);
-			if (0 == ileftvideo) {
-				ileftvideo = RVC_MAX_VIDEO_FRESH_TIME/2;
-			}
-			if (0 == irightvideo) {
-				irightvideo = RVC_MAX_VIDEO_FRESH_TIME/2;
-			}
-
-			if (ileftvideo < RVC_MIN_VIDEO_FRESH_TIME) {
-				ileftvideo = RVC_MIN_VIDEO_FRESH_TIME;
-			}
-			if (ileftvideo > RVC_MAX_VIDEO_FRESH_TIME) {
-				ileftvideo = RVC_MAX_VIDEO_FRESH_TIME;
-			}
-
-			if (irightvideo < RVC_MIN_VIDEO_FRESH_TIME) {
-				irightvideo = RVC_MIN_VIDEO_FRESH_TIME;
-			}
-			if (irightvideo > RVC_MAX_VIDEO_FRESH_TIME) {
-				irightvideo = RVC_MAX_VIDEO_FRESH_TIME;
-			}
-		}
-	}
-
-	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;	
-}
-
-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);
-}
-
-
-static CSimpleStringA generateAudioDspFlags(endpoint_conf_t* conf)
-{
-	int ipickup_in_agc = 0;
-	int ipickup_out_agc = 0;
-	int ihandfree_in_agc = 0;
-	int ihandfree_out_agc = 0;
-
-	int ipickup_in_ns = 0;
-	int ipickup_out_ns = 0;
-	int ihandfree_in_ns = 0;
-	int ihandfree_out_ns = 0;
-
-	int ipickup_aec = 0;
-	int ihandfree_aec = 0;
-
-	if (conf) {
-		conf->audio_pickup_in_agc ? ipickup_in_agc = 1 : ipickup_in_agc = 0;
-		conf->audio_pickup_out_agc ? ipickup_out_agc = 1 : ipickup_out_agc = 0;
-		conf->audio_handfree_in_agc ? ihandfree_in_agc = 1 : ihandfree_in_agc = 0;
-		conf->audio_handfree_out_agc ? ihandfree_out_agc = 1 : ihandfree_out_agc = 0;
-		conf->audio_pickup_in_ns ? ipickup_in_ns = 1 : ipickup_in_ns = 0;
-		conf->audio_pickup_out_ns ? ipickup_out_ns = 1 : ipickup_out_ns = 0;
-		conf->audio_handfree_in_ns ? ihandfree_in_ns = 1 : ihandfree_in_ns = 0;
-		conf->audio_handfree_out_ns ? ihandfree_out_ns = 1 : ihandfree_out_ns = 0;
-		conf->audio_pickup_aec ? ipickup_aec = 1 : ipickup_aec = 0;
-		conf->audio_handfree_aec ? ihandfree_aec = 1 : ihandfree_aec = 0;
-
-		return CSimpleStringA::Format("{\"handfree_in_agc\":\"%d\",\"handfree_out_agc\":\"%d\",\"pickup_in_agc\":\"%d\",\"pickup_out_agc\":\"%d\",\"handfree_in_ns\":\"%d\",\"handfree_out_ns\":\"%d\",\"pickup_in_ns\":\"%d\",\"pickup_out_ns\":\"%d\",\"handfree_aec\":\"%d\",\"pickup_aec\":\"%d\"}",
-			ihandfree_in_agc, ihandfree_out_agc, ipickup_in_agc, ipickup_out_agc,
-			ihandfree_in_ns, ihandfree_out_ns, ipickup_in_ns, ipickup_out_ns,
-			ihandfree_aec, ipickup_aec);
-	}
-	else {
-		return "NULL";
-	}
-}
-
 ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 {
 	CSmartPointer<IEntityFunction> spFunction = GetFunction();
@@ -1937,16 +1887,16 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 		table.AddEntryString("audio", "handfree_out_dev", strHandFreeOut, "$");
 		table.AddEntryString("audio", "pickup_in_dev", strPickupIn, "$");
 		table.AddEntryString("audio", "pickup_out_dev", strPickupOut, "$");
-		table.AddEntryBoolean("audio", "pickup_out_agc", conf->audio_pickup_out_agc, false);
-		table.AddEntryBoolean("audio", "pickup_in_agc", conf->audio_pickup_in_agc, false);
-		table.AddEntryBoolean("audio", "handfree_in_agc", conf->audio_handfree_in_agc, false);
-		table.AddEntryBoolean("audio", "handfree_out_agc", conf->audio_handfree_out_agc, false);
-		table.AddEntryBoolean("audio", "pickup_out_ns", conf->audio_pickup_out_ns, false);
-		table.AddEntryBoolean("audio", "pickup_in_ns", conf->audio_pickup_in_ns, false);
-		table.AddEntryBoolean("audio", "handfree_in_ns", conf->audio_handfree_in_ns, false);
-		table.AddEntryBoolean("audio", "handfree_out_ns", conf->audio_handfree_out_ns, false);
-		table.AddEntryBoolean("audio", "pickup_aec", conf->audio_pickup_aec, false);
-		table.AddEntryBoolean("audio", "handfree_aec", conf->audio_handfree_aec, false);
+		table.AddEntryBoolean("audio", "pickup_out_agc", conf->audio_dsp.audio_pickup_out_agc, false);
+		table.AddEntryBoolean("audio", "pickup_in_agc", conf->audio_dsp.audio_pickup_in_agc, false);
+		table.AddEntryBoolean("audio", "handfree_in_agc", conf->audio_dsp.audio_handfree_in_agc, false);
+		table.AddEntryBoolean("audio", "handfree_out_agc", conf->audio_dsp.audio_handfree_out_agc, false);
+		table.AddEntryBoolean("audio", "pickup_out_ns", conf->audio_dsp.audio_pickup_out_ns, false);
+		table.AddEntryBoolean("audio", "pickup_in_ns", conf->audio_dsp.audio_pickup_in_ns, false);
+		table.AddEntryBoolean("audio", "handfree_in_ns", conf->audio_dsp.audio_handfree_in_ns, false);
+		table.AddEntryBoolean("audio", "handfree_out_ns", conf->audio_dsp.audio_handfree_out_ns, false);
+		table.AddEntryBoolean("audio", "pickup_aec", conf->audio_dsp.audio_pickup_aec, false);
+		table.AddEntryBoolean("audio", "handfree_aec", conf->audio_dsp.audio_handfree_aec, false);
 		table.AddEntryInt("audio", "handfree_in_volume", m_kept_volume_in[DEV_HANDFREE], 0);
 		table.AddEntryInt("audio", "handfree_out_volume", m_kept_volume_out[DEV_HANDFREE], 0);
 		table.AddEntryInt("audio", "pickup_in_volume", m_kept_volume_in[DEV_PICKUP], 0);
@@ -1959,12 +1909,16 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 			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]));
-			LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_AUDIO_DSP_INFO, generateAudioDspFlags(conf).GetData());
+			LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_AUDIO_DSP_INFO, generateAudioDspFlags(conf->audio_dsp).GetData());
+
+			if (m_iAudioDspUseCenter) {
+				AudioDspFlagsUseCentersetting(conf);
+				LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_CENTER_AUDIO_DSP_FLAGS, generateAudioDspFlags(conf->audio_dsp).GetData());
+			}
+			int id = -1;
 #ifdef RVC_OS_WIN
 			id = capture_get_audio_device_id(true, strHandFreeIn);
 #else
@@ -2051,8 +2005,6 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 		}
 	}
 
-	InitFreshTimeConfig();
-
 	return Error;
 }
 
@@ -2213,21 +2165,99 @@ DeviceTypeEnum CSIPEntity::RvcGetDeviceType()
 }
 
 
+ErrorCodeEnum CSIPEntity::LoadEntityConfig()
+{
+	int iAudioDspUseCenter = 0;
+	int ileftvideo = RVC_VIDEO_FRESH_TIME;
+	int irightvideo = RVC_VIDEO_FRESH_TIME;
+
+	CSmartPointer<IConfigInfo> spCacheConfig;
+	ErrorCodeEnum Error = GetFunction()->OpenConfig(Config_CenterSetting, spCacheConfig);
+	if (Error_Succeed == Error) {
+		SpIniMappingTable table;
+		table.AddEntryInt("SipPhone", "AudioDspUseCenter", iAudioDspUseCenter, 0);
+		table.AddEntryInt("SIPPhone", "lfreshtime", ileftvideo, RVC_VIDEO_FRESH_TIME);
+		table.AddEntryInt("SIPPhone", "rfreshtime", irightvideo, RVC_VIDEO_FRESH_TIME);
+		Error = table.Load(spCacheConfig);
+		if (Error == Error_Succeed) {
+			m_iAudioDspUseCenter = iAudioDspUseCenter;
+
+			if (0 == ileftvideo) {
+				ileftvideo = RVC_VIDEO_FRESH_TIME;
+			}
+			if (0 == irightvideo) {
+				irightvideo = RVC_VIDEO_FRESH_TIME;
+			}
+
+			if (ileftvideo < RVC_MIN_VIDEO_FRESH_TIME) {
+				ileftvideo = RVC_MIN_VIDEO_FRESH_TIME;
+			}
+			if (ileftvideo > RVC_MAX_VIDEO_FRESH_TIME) {
+				ileftvideo = RVC_MAX_VIDEO_FRESH_TIME;
+			}
+
+			if (irightvideo < RVC_MIN_VIDEO_FRESH_TIME) {
+				irightvideo = RVC_MIN_VIDEO_FRESH_TIME;
+			}
+			if (irightvideo > RVC_MAX_VIDEO_FRESH_TIME) {
+				irightvideo = RVC_MAX_VIDEO_FRESH_TIME;
+			}
+
+			m_ilocalvideo_freshtime = ileftvideo;
+			m_iremotevideo_freshtime = irightvideo;
+		}
+	}
+
+	return Error;
+}
+
+
+ErrorCodeEnum CSIPEntity::AudioDspFlagsUseCentersetting(endpoint_conf_t* conf)
+{
+	SpIniMappingTable table;
+	CSmartPointer<IConfigInfo> spConfig;
+
+	endpoint_audiodsp_config_t audiodsp = { false, false, false, false, true, false, true, false, false, false };
+	table.AddEntryBoolean("SipPhone", "pickup_out_agc", audiodsp.audio_pickup_out_agc, false);
+	table.AddEntryBoolean("SipPhone", "pickup_in_agc", audiodsp.audio_pickup_in_agc, false);
+	table.AddEntryBoolean("SipPhone", "handfree_in_agc", audiodsp.audio_handfree_in_agc, false);
+	table.AddEntryBoolean("SipPhone", "handfree_out_agc", audiodsp.audio_handfree_out_agc, false);
+	table.AddEntryBoolean("SipPhone", "pickup_out_ns", audiodsp.audio_pickup_out_ns, false);
+	table.AddEntryBoolean("SipPhone", "pickup_in_ns", audiodsp.audio_pickup_in_ns, true);
+	table.AddEntryBoolean("SipPhone", "handfree_in_ns", audiodsp.audio_handfree_in_ns, true);
+	table.AddEntryBoolean("SipPhone", "handfree_out_ns", audiodsp.audio_handfree_out_ns, false);
+	table.AddEntryBoolean("SipPhone", "pickup_aec", audiodsp.audio_pickup_aec, false);
+	table.AddEntryBoolean("SipPhone", "handfree_aec", audiodsp.audio_handfree_aec, true);
+
+	ErrorCodeEnum Error = GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
+	if (Error == Error_Succeed) {
+		Error = table.Load(spConfig);
+		if (Error_Succeed == Error) {
+			memcpy(&conf->audio_dsp, &audiodsp, sizeof(endpoint_audiodsp_config_t));
+		}
+	}
+	else {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AudioDspFlagsUseCentersetting load Centersetting failed!");
+		memcpy(&conf->audio_dsp, &audiodsp, sizeof(endpoint_audiodsp_config_t));
+	}
+	return Error;
+}
 
 //
 // CSIPPhoneSession
 //
+CSIPPhoneSession::CSIPPhoneSession(CSIPEntity* pEntity) : m_pEntity(pEntity), m_pCall(NULL), m_iLastState(0)
+{
 
+}
 
 void CSIPPhoneSession::OnClose( ErrorCodeEnum eErrorCode )
 {
-	LOG_FUNCTION();
+	
 }
 
 void CSIPPhoneSession::Handle_MakeCall( SpReqAnsContext<PhoneService_MakeCall_Req, PhoneService_MakeCall_Ans>::Pointer ctx )
 {
-	LOG_FUNCTION();
-
 	char strmsg[MAX_PATH] = {0};
 	snprintf(strmsg, MAX_PATH, "make call [%s]", (LPCSTR)ctx->Req.to_uri);
 	LogWarn(Severity_Low, Error_Debug, EVENT_MOD_SIP_CALL_URL, strmsg);
@@ -2291,7 +2321,6 @@ void CSIPPhoneSession::Handle_MakeCall( SpReqAnsContext<PhoneService_MakeCall_Re
 
 void CSIPPhoneSession::Handle_HangupCall( SpReqAnsContext<PhoneService_HangupCall_Req, PhoneService_HangupCall_Ans>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	int rc = Error_Succeed;
 	HangupCallCommand *cmd = new HangupCallCommand();
 	cmd->pSIPPhoneSession = this;
@@ -2323,21 +2352,18 @@ void CSIPPhoneSession::Handle_ReleaseCall( SpReqAnsContext<PhoneService_ReleaseC
 
 void CSIPPhoneSession::Handle_SetCallingParam(SpOnewayCallContext<PhoneService_SetCallingParam_Info>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SetCallingParam CallType = %d", ctx->Info.CallType);
 	m_pEntity->m_nCallType = (CallingTypeEnum)ctx->Info.CallType;
 }
 
 void CSIPPhoneSession::Handle_RealErrorCheck(SpOnewayCallContext<PhoneService_RealErrorCheck_Info>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	m_pEntity->m_SipErrorCode = Error_InvalidState;
 	m_pEntity->RealSelfCheck();
 }
 
 void CSIPPhoneSession::Handle_StartVideo( SpOnewayCallContext<PhoneService_StartVideo_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	int rc;
 	ControlVideoCommand *pCmd = new ControlVideoCommand();
 	pCmd->pSIPPhoneSession = this;
@@ -2368,7 +2394,6 @@ void CSIPPhoneSession::Handle_StartVideo( SpOnewayCallContext<PhoneService_Start
 
 void CSIPPhoneSession::Handle_StopVideo( SpOnewayCallContext<PhoneService_StopVideo_Info>::Pointer ctx )
 {
-	LOG_FUNCTION();
 	int rc;
 	ControlVideoCommand *pCmd = new ControlVideoCommand();
 	pCmd->pSIPPhoneSession = this;
@@ -2386,7 +2411,6 @@ void CSIPPhoneSession::Handle_StopVideo( SpOnewayCallContext<PhoneService_StopVi
 
 void CSIPPhoneSession::Handle_StartVideoRender(SpOnewayCallContext<PhoneService_StartVideoRender_Info>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	int rc;
 	VideoRenderCommand_t* pCmd = new VideoRenderCommand_t();
 	pCmd->pSIPPhoneSession = this;
@@ -2437,7 +2461,6 @@ void CSIPPhoneSession::Handle_EndState( SpOnewayCallContext<PhoneService_EndStat
 
 void CSIPPhoneSession::Handle_GetHandfreeOutVolume(SpReqAnsContext<PhoneService_GetHandfreeOutVolume_Req, PhoneService_GetHandfreeOutVolume_Ans>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	ctx->Ans.Volume = m_pEntity->m_kept_volume_out[DEV_HANDFREE];
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("get hand free out volume is %d.", ctx->Ans.Volume);
 	ctx->Answer(Error_Succeed);
@@ -2446,7 +2469,6 @@ void CSIPPhoneSession::Handle_GetHandfreeOutVolume(SpReqAnsContext<PhoneService_
 
 void CSIPPhoneSession::Handle_SetHandfreeOutVolume(SpReqAnsContext<PhoneService_SetHandfreeOutVolume_Req, PhoneService_SetHandfreeOutVolume_Ans>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	int iVolume = ctx->Req.Volume;
 	if (iVolume > 100){
 		iVolume = 100;
@@ -2462,7 +2484,6 @@ void CSIPPhoneSession::Handle_SetHandfreeOutVolume(SpReqAnsContext<PhoneService_
 
 void CSIPPhoneSession::Handle_GetPickupOutVolume(SpReqAnsContext<PhoneService_GetPickupOutVolume_Req, PhoneService_GetPickupOutVolume_Ans>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	if (eStand2sType == m_pEntity->m_eDeviceType){
 		ctx->Ans.Volume = m_pEntity->m_kept_volume_out[DEV_PICKUP];
 	} 
@@ -2477,7 +2498,6 @@ void CSIPPhoneSession::Handle_GetPickupOutVolume(SpReqAnsContext<PhoneService_Ge
 
 void CSIPPhoneSession::Handle_SetPickupOutVolume(SpReqAnsContext<PhoneService_SetPickupOutVolume_Req, PhoneService_SetPickupOutVolume_Ans>::Pointer ctx)
 {
-	LOG_FUNCTION();
 	if (eStand2sType == m_pEntity->m_eDeviceType) {
 		int iVolume = ctx->Req.Volume;
 		if (iVolume > 100) {
@@ -2589,7 +2609,6 @@ int CSIPPhoneSession::make_call( MakeCallCommand_t *pCmd)
 
 void CSIPPhoneSession::control_video( ControlVideoCommand *pCmd )
 {
-	LOG_FUNCTION();
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d m_pCall = 0x%08x.", __FUNCTION__, __LINE__, m_pCall);
 	if (m_pCall) 
 	{
@@ -2659,8 +2678,6 @@ void CSIPPhoneSession::control_video( ControlVideoCommand *pCmd )
 
 void CSIPPhoneSession::video_render(VideoRenderCommand_t* pCmd)
 {
-	LOG_FUNCTION();
-
 	if (true== pCmd->bstart) {
 		rvc_video_render_params_t render_param = { 0 };
 		render_param.ilocal_view_x = pCmd->local_view_x;

+ 3 - 12
Module/mod_sipphone/mod_sipphone.h

@@ -29,12 +29,10 @@ class CSIPPhoneSession;
 struct CVolumnValue
 {
 	int nValue;
-
 	void Serialize(SpBuffer &Buf)
 	{
 		Buf & nValue;
 	}
-
 };
 
 
@@ -70,20 +68,12 @@ typedef struct record_echo_location_s{
 	int height;
 }record_echo_location_t;
 
-
 enum ePickupMicrophoneState
 {
 	ePickupMicrophoneState_On,
 	ePickupMicrophoneState_Off,
 };
 
-/* 0:online local and remote video window, 1:only local video window, 2:both local and remote window */
-//enum eShowVideoWindowType{
-//	eOnline_Mode_Video,
-//	eOnly_Local_Video,
-//	eBoth_Local_Remote_Video
-//};
-
 typedef struct MakeCallCommand_s
 {
 	CSIPPhoneSession *pSIPPhoneSession;
@@ -264,7 +254,6 @@ public:
 private:
 
 	ErrorCodeEnum LoadConfig(endpoint_conf_t *conf);
-	void InitFreshTimeConfig();
 	//载入运行时配置
 	ErrorCodeEnum LoadAudioRunConfig(int&nHandfreeout,int&nPickupout,int&nHandfreein,int&nPickupin);
 	//保存运行时
@@ -280,6 +269,8 @@ private:
 	void ShowLocalVideo();
 	void HideBothVideo();
 	void ShowBothVideo();
+	ErrorCodeEnum LoadEntityConfig();
+	ErrorCodeEnum AudioDspFlagsUseCentersetting(endpoint_conf_t* conf);
 
 public:
 	int m_kept_volume_in[2];
@@ -305,7 +296,7 @@ public:
 	record_echo_location_t m_RecordVideoLocation;
 	int m_ilocalvideo_freshtime;
 	int m_iremotevideo_freshtime;
-
+	int m_iAudioDspUseCenter;
 	rvc_video_render_t* m_render;
 
 private:

+ 12 - 3
Module/mod_sipphone/video_session.cpp

@@ -54,8 +54,6 @@ extern "C"
 #include "../../Other/libvideoframework/video_common/ffmpeg_api_cpp_adapter.h"
 
 
-BOOL g_bIsSalesRecord = FALSE;
-
 #define WNDCLS_NAME	"sipmedia_video"
 #define MAX_PATH_SIZE 256
 
@@ -112,7 +110,18 @@ struct video_session_t
 
 static void __dbg(void *user_data, const char *fmt, va_list arg)
 {
-	vDbg(fmt, arg);
+	int n = vsnprintf(NULL, 0, fmt, arg);
+	if (n >= MAX_PATH) {
+		char* buf = (char*)malloc((size_t)(n + 1));
+		vsnprintf(buf, n + 1, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", buf);
+		free(buf);
+	}
+	else {
+		char strlog[MAX_PATH] = { 0 };
+		vsnprintf(strlog, MAX_PATH, fmt, arg);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s", strlog);
+	}
 }
 
 

+ 1 - 1
Module/mod_snapshot/mod_snapshot.cpp

@@ -448,7 +448,7 @@ public:
 		else if (LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS == dwUserCode)
 		{
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("recv LOG_EVT_MOD_ASSISCHAN_STARTED_SUCCESS");
-			Sleep(975);
+			usleep(975*1000);
 			if (m_pChannelClient != NULL){
 				m_pChannelClient->GetFunction()->CloseSession();
 				m_pChannelClient = NULL;

+ 1 - 1
Other/libaudiomgr/linux/core_time.cpp

@@ -100,7 +100,7 @@ uint64_t ns_time_monotonic()
 
 	if(clock_gettime(CLOCK_MONOTONIC, &now) != 0)
 	{
-		printf("V4L2_CORE: ns_time_monotonic (clock_gettime) error: %s\n", strerror(errno));
+		//printf("V4L2_CORE: ns_time_monotonic (clock_gettime) error: %s\n", strerror(errno));
 		return 0;
 	}
 

+ 1 - 2
Other/libaudiomgr/linux/libaudiomgr_linux.cpp

@@ -77,7 +77,7 @@ int AudioMgrImpl::audio_init_pulseaudio()
 
 	if (pa_get_devicelist() < 0)
 	{
-		audiolog( "pulse audio failed to get audio device list from pulse server\n");
+		audiolog( "pulse audio failed to get audio device list from pulse server.");
 		return -1;
 	}
 
@@ -286,7 +286,6 @@ static void pa_sinklist_cb(pa_context* c, const pa_sink_info* l, int eol, void*
 	audio_ctx->list_output_devices = (rvc_audio_device_t*)realloc(audio_ctx->list_output_devices, audio_ctx->num_output_dev * sizeof(rvc_audio_device_t));
 	if (audio_ctx->list_output_devices == NULL)
 	{
-		printf("AUDIO: FATAL memory allocation failure (pa_sinklist_cb): %s\n", strerror(errno));
 		exit(-1);
 	}
 	/*fill device data*/

+ 1 - 1
Other/libvideoframework/video_statics/video_stats.c

@@ -437,7 +437,7 @@ static void* video_stats_loop_event(void* arg)
 			prev_ts = now_ts;
 		}
 
-		Sleep(5);
+		usleep(5*1000);
 	}
 
 	s->run = -1;