|
@@ -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;
|