Преглед изворни кода

Z991239-3329 #comment 视频渲染频率支持通过集中配置设置

陈礼鹏80274480 пре 3 година
родитељ
комит
51eb1cf399

+ 1 - 1
Module/mod_sipphone/Event.h

@@ -86,7 +86,7 @@
 #define EVENT_MOD_SIP_REMOTE_VIDEO_RENDER_CREATE					0x30190032
 #define EVENT_MOD_SIP_LOCAL_VIDEO_RENDER_DESTROY					0x30190033
 #define EVENT_MOD_SIP_REMOTE_VIDEO_RENDER_DESTROY					0x30190034
-#define EVENT_MOD_SIP_OVERWRITE_FRESHVALUE	                 				0x30190036
+#define EVENT_MOD_SIP_OVERWRITE_FRESHVALUE	                 		0x30190036
 
 //audio engine error
 #define ERROR_MOD_SIP_APR_POOL_CREATE_FAILED						0x30190601  //内存分配失败,级别2

+ 3 - 2
Module/mod_sipphone/endpoint.cpp

@@ -343,7 +343,8 @@ static void endpoint_media_update_video(endpoint_call_t *call, media_desc_t *vid
 		video_conf.ilocal_wind_flags = VIDEOPLAYER_FLAG_PULL|VIDEOPLAYER_FLAG_CHECKTOP;
 		video_conf.iremote_wind_flags = VIDEOPLAYER_FLAG_PUSH|VIDEOPLAYER_FLAG_CHECKTOP;
 		video_conf.ilvideo_ft = local_fresh_time;
-		
+		video_conf.irvideo_ft = remote_fresh_time;
+
 		if (video_conf.nCallType == MOBILETOPAD_CALLTYPE )  //如果与手机连接使用标准H264
 		{
 			video_conf.local_pt = video_desc->local_pt;
@@ -503,7 +504,7 @@ static const char *call_make_offer(endpoint_call_t *call, char *buf, int size)
 	int need;
 	const char *fmt;
 
-	Dbg("make call offer,device type is %s, Call Type is %s", Device_Type_Table[call->eDeviceType], call_type_table[call->nCallType]);
+	Dbg("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 == MOBILETOPAD_CALLTYPE)  //如果跟手机对接

+ 40 - 12
Module/mod_sipphone/mod_sipphone.cpp

@@ -40,6 +40,17 @@
 #define SMALL_RECORD_VIDEO_HEIGHT 138
 #endif
 
+#ifndef RVC_VIDEO_FRESH_TIME
+#define RVC_VIDEO_FRESH_TIME 50
+#endif // !RVC_VIDEO_FRESH_TIME
+
+#ifndef RVC_MAX_VIDEO_FRESH_TIME
+#define RVC_MAX_VIDEO_FRESH_TIME 200
+#endif // !RVC_MAX_VIDEO_FRESH_TIME
+
+#ifndef RVC_MIN_VIDEO_FRESH_TIME
+#define RVC_MIN_VIDEO_FRESH_TIME 1
+#endif // !RVC_MAX_VIDEO_FRESH_TIME
 
 /////////////////////////////////////////////
 // future roadmap
@@ -122,7 +133,8 @@ CSIPEntity::CSIPEntity() : m_pCurrentSession(NULL), m_state(INIT),m_iPickupPhone
 #endif
 	m_SipErrorCode = Error_Succeed;
 	memset((void*)&m_stVideoParam,0,sizeof(stVideoParam));
-	m_ilocalvideo_freshtime = 200;
+	m_ilocalvideo_freshtime = RVC_VIDEO_FRESH_TIME;
+	m_iremotevideo_freshtime = RVC_VIDEO_FRESH_TIME;
 }
 
 
@@ -229,7 +241,7 @@ void CSIPEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const
 				// 话筒模式开始远程双录连线
 				m_iPickupPhoneState = ePickupMicrophoneState_On;
 			}
-			LOG_TRACE("dwUserCode = 0x%08x,m_iPickupPhoneState %d", dwUserCode, m_iPickupPhoneState);
+			LOG_TRACE("dwUserCode = 0x%08x,m_iPickupPhoneState %d.", dwUserCode, m_iPickupPhoneState);
 			Dbg("dwUserCode = 0x%08x,old_PhoneState = %d,PickupPhoneState = %d", dwUserCode,old_state, m_iPickupPhoneState);
 			if (old_state != m_iPickupPhoneState) 
 			{
@@ -1750,15 +1762,32 @@ void CSIPEntity::Handle_AdjustVideoEchoEvent(const char* pszMessage)
 void CSIPEntity::InitFreshTimeConfig()
 {
     CSmartPointer<IConfigInfo> spCacheConfig;
-    GetFunction()->OpenConfig(Config_Cache, spCacheConfig);
+    GetFunction()->OpenConfig(Config_CenterSetting, spCacheConfig);
+
+	int ileftvideo(RVC_VIDEO_FRESH_TIME);
+	int irightvideo(RVC_VIDEO_FRESH_TIME);
+	spCacheConfig->ReadConfigValueInt("SIPPhone", "lfreshtime", ileftvideo);
+	spCacheConfig->ReadConfigValueInt("SIPPhone", "rfreshtime", irightvideo);
+	
+	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;
+	}
 
-	int value(0);
-	spCacheConfig->ReadConfigValueInt("SIPPhone", "lfreshtime", value);
-	if (value > 0) {
-		LogWarn(Severity_Middle, Error_Debug, EVENT_MOD_SIP_OVERWRITE_FRESHVALUE,
-				CSimpleStringA::Format("overwrite lfreshtime from global cache: %d", value));
-        m_ilocalvideo_freshtime = value;
+	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_Middle, 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;
+	
 }
 
 ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
@@ -1878,9 +1907,6 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 			//DecideCameraCount(conf->camera_count);
 			DecideScreenCount(conf->screen_count);
 
-			if (m_ilocalvideo_freshtime > 500 || m_ilocalvideo_freshtime < 50) {
-				m_ilocalvideo_freshtime = 200;
-			}
 		}
 	}
 
@@ -1889,6 +1915,7 @@ ErrorCodeEnum CSIPEntity::LoadConfig(endpoint_conf_t *conf)
 	return Error;
 }
 
+
 //载入运行时配置
 ErrorCodeEnum CSIPEntity::LoadAudioRunConfig(int&nHandfreeout,int&nPickupout,int&nHandfreein,int&nPickupin)
 {
@@ -2199,6 +2226,7 @@ void CSIPPhoneSession::Handle_StartVideo( SpOnewayCallContext<PhoneService_Start
 	pCmd->local_hwd_move = ctx->Info.local_hwd_move;
 	pCmd->remote_hwd_move = ctx->Info.remote_hwd_move;
 	pCmd->local_fresh_time = m_pEntity->m_ilocalvideo_freshtime;
+	pCmd->remote_fresh_time = m_pEntity->m_iremotevideo_freshtime;
 	//初始化窗口参数
 	//m_pEntity->m_stVideoParam.nWindowState = 0;
 	//m_pEntity->GetFunction()->SetTimer(1, m_pEntity, 1000);

+ 1 - 0
Module/mod_sipphone/mod_sipphone.h

@@ -271,6 +271,7 @@ public:
 	volatile int m_bEwsRecord;				//add by ly@2019/04/18
 	record_echo_location_t m_RecordVideoLocation;
 	int m_ilocalvideo_freshtime;
+	int m_iremotevideo_freshtime;
 
 private:
 	CServerSessionBase *m_pCurrentSession;

+ 1 - 0
Module/mod_sipphone/video_session.cpp

@@ -1289,6 +1289,7 @@ static int start_video_rtpsession(video_session_t* session)
 	config.on_rx_udp = &on_rx_udp;
 	config.dbg = &__dbg;
 	config.logevent = &__logevent;
+	config.fresh_time = session->conf.irvideo_ft;
 	if (0 == videortp_create(&config, &session->rtp)) {
 		Dbg("videortp create success!");
 	}

+ 1 - 0
Module/mod_sipphone/video_session.h

@@ -41,6 +41,7 @@ typedef struct video_session_conf_t
 	int video_quant; // 0-10
 	int bit_rate; // 256*1024
 	int ilvideo_ft;
+	int irvideo_ft;
 	DeviceTypeEnum eDeviceType;
 	CallingTypeEnum nCallType; 
 	int local_pt;