浏览代码

Z991239-5614 #comment UOS支持下摄像头回显

80274480 1 年之前
父节点
当前提交
8643852c92

+ 2 - 5
Module/mod_sipphone/mod_sipphone.cpp

@@ -63,7 +63,7 @@ static int __make_call(void *user_data)
 static int __hangup_call(void *user_data)
 {
 	HangupCallCommand_t *cmd = (HangupCallCommand_t*)(user_data);
-	cmd->pSIPPhoneSession->hangup_call(cmd);
+	cmd->pSIPPhoneSession->hangup_call();
 	delete cmd;
 	return 0;
 }
@@ -2466,9 +2466,6 @@ void CSIPPhoneSession::Handle_HangupCall( SpReqAnsContext<PhoneService_HangupCal
 	int rc = Error_Succeed;
 	HangupCallCommand_t *cmd = new HangupCallCommand_t();
 	cmd->pSIPPhoneSession = this;
-	cmd->strSession_num = ctx->Req.session_num;
-	cmd->strBranch_server_ip = ctx->Req.branch_server_ip;
-	cmd->iBranch_server_port = ctx->Req.branch_server_port;
 	if (m_pEntity->GetEndpoint())
 	{
 		endpoint_invoke(m_pEntity->GetEndpoint(), &__hangup_call, cmd, &rc);
@@ -2772,7 +2769,7 @@ void CSIPPhoneSession::Handle_SetPickupOutVolume(SpReqAnsContext<PhoneService_Se
 	ctx->Answer(Error_Succeed);
 }
 
-void CSIPPhoneSession::hangup_call(HangupCallCommand_t* cmd)
+void CSIPPhoneSession::hangup_call()
 {
 	if (m_pCall) {
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("normal hangup.");

+ 1 - 5
Module/mod_sipphone/mod_sipphone.h

@@ -171,7 +171,6 @@ typedef struct ControlVideoCommand_s {
 	int remote_hwd_move;
 	int local_fresh_time;
 	int remote_fresh_time;
-	int local_render_camera;
 }ControlVideoCommand_t;
 
 
@@ -196,9 +195,6 @@ typedef struct VideoRenderCommand_s
 
 typedef struct HangupCallCommand_s{
 	CSIPPhoneSession *pSIPPhoneSession;
-	CSimpleStringA strSession_num;
-	CSimpleStringA strBranch_server_ip;
-	int iBranch_server_port;
 }HangupCallCommand_t;
 
 
@@ -246,7 +242,7 @@ public:
 public:
 	void on_call_state(int state, const char *state_desc, const char *phrase);
 	int make_call(MakeCallCommand_t *pCmd);
-	void hangup_call(HangupCallCommand_t *pCmd);
+	void hangup_call();
 	void release_call();
 	void control_video(ControlVideoCommand_t* pCmd);
 	int on_video_box_move(int imessagetype, int ivideotype, int ileft, int ibottom);

+ 47 - 5
Module/mod_sipphone/video_render.cpp

@@ -70,12 +70,22 @@ static int rvc_video_shm_enqueue(Clibvideoqueue* shm_queue, video_frame* frame,
 	}
 }
 
-static int get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue* local_video_queue, IplImage* personimage, IplImage* personmask)
+static int get_local_video_frame(video_frame** frame, int itype, Clibvideoqueue* local_video_queue, int iwidth, int iheight, IplImage* personimage, IplImage* personmask)
 {
 	video_frame* tmp_frame_preview = NULL;
-	tmp_frame_preview = video_frame_new(REC_COMMON_VIDEO_PREVIEW_WIDTH, REC_COMMON_VIDEO_PREVIEW_HEIGHT, VIDEO_FORMAT_RGB24);
+	tmp_frame_preview = video_frame_new(iwidth, iheight, VIDEO_FORMAT_RGB24);
 	videoq_frame frm;
 	frm.data = tmp_frame_preview->data[0];
+
+	static bool blog = true;
+	if (blog) {
+		int ivideo_width = 0;
+		int ivideo_height = 0;
+		int isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("isize = %d, ivideo_width = %d, ivideo_height = %d.", isize, ivideo_width, ivideo_height);
+		blog = false;
+	}
+
 	//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d, session->video_shm_q_preview = 0x%08x.", __FUNCTION__, __LINE__, local_video_queue);
 	bool result = local_video_queue->GetVideo(&frm, VIDEOQUEUE_FLAG_HORIZONTAL_FLIP);
 	if (result){
@@ -127,7 +137,34 @@ void* rvc_videorender_func(void* arg)
 {
 	rvc_video_render_t* param = (rvc_video_render_t*)arg;
 	int ilocal_video_fresh_time = param->render_param.ilocal_fresh_time;
-	Clibvideoqueue* local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE);
+
+	int irender_camera = CAMERA_TYPE_ENV;
+	if (param->render_param.ilocal_view_cx < param->render_param.ilocal_view_cy) {
+		irender_camera = CAMERA_TYPE_OPT;
+	}
+
+	Clibvideoqueue* local_video_queue = NULL;
+	int iwidth = 0;
+	int iheight = 0;
+	if (CAMERA_TYPE_ENV == irender_camera) {
+		local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_ENV_SHM_PREVIEW_QUEUE);
+		iwidth = REC_COMMON_VIDEO_PREVIEW_WIDTH;
+		iheight = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
+	}
+	else {
+		local_video_queue = new Clibvideoqueue(REC_COMMON_VIDEO_OPT_SHM_PREVIEW_QUEUE);
+		iwidth = REC_COMMON_VIDEO_PREVIEW_HEIGHT;
+		iheight = REC_COMMON_VIDEO_PREVIEW_WIDTH;
+	}
+
+	int ivideo_width = 0;
+	int ivideo_height = 0;
+	int isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d isize = %d, ivideo_width = %d, ivideo_height = %d.",__FUNCTION__, __LINE__, isize, ivideo_width, ivideo_height);
+	if (ivideo_width > 0 && ivideo_height > 0) {
+		iwidth = ivideo_width;
+		iheight = ivideo_height;
+	}
 
 	char strPersonPath[MAX_PATH] = { 0 };
 	snprintf(strPersonPath, MAX_PATH, "./bin/rxk.jpg");
@@ -176,6 +213,11 @@ void* rvc_videorender_func(void* arg)
 		bool bset = true;
 
 		param->plocal_render->StartVideoRender();
+		ivideo_width = 0;
+		ivideo_height = 0;
+		isize = local_video_queue->GetFrameSize(ivideo_width, ivideo_height);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s:%d isize = %d, ivideo_width = %d, ivideo_height = %d.", __FUNCTION__, __LINE__, isize, ivideo_width, ivideo_height);
+
 		for (; ; ) {
 			struct timespec ts;
 			clock_gettime(CLOCK_REALTIME, &ts);
@@ -186,11 +228,11 @@ void* rvc_videorender_func(void* arg)
 			{
 				video_frame* local_video_frame = NULL;
 				int iwindowstate = param->cb.on_window_type(param->cb.user_data);
-				get_local_video_frame(&local_video_frame, iwindowstate, local_video_queue, personimage, personmask);
+				get_local_video_frame(&local_video_frame, iwindowstate, local_video_queue, iwidth, iheight, personimage, personmask);
 
 				if (NULL != local_video_frame) {
 					video_frame* localframe = NULL;
-					if (0 == translate_image_resolution(&localframe, param->render_param.ilocal_view_cx, param->render_param.ilocal_view_cy, local_video_frame)) {
+					if (0 == translate_image_resolution(&localframe, param->render_param.ilocal_view_cx, param->render_param.ilocal_view_cy, local_video_frame)) {					
 						param->plocal_render->RenderVideoFrame(localframe, RVC_FLIP_VERTICAL);
 						video_frame_delete(localframe);
 						localframe = NULL;

+ 0 - 1
Module/mod_sipphone/video_render.h

@@ -43,7 +43,6 @@ typedef struct rvc_video_render_params_s {
 	int iremote_move; 
 	int ilocal_fresh_time;
 	int iremote_fresh_time;
-	int ilocal_render_camera;
 }rvc_video_render_params_t;
 
 

+ 0 - 3
Other/rvcmediacommon/rvc_media_common.h

@@ -37,9 +37,6 @@
 #define REC_COMMON_VIDEO_RTP_OPT_WIDTH		180
 #define REC_COMMON_VIDEO_RTP_OPT_HEIGHT		320
 
-#define REC_COMMON_VIDEO_RTP_EWS_WIDTH		320	
-#define REC_COMMON_VIDEO_RTP_EWS_HEIGHT		180
-
 #define REC_COMMON_VIDEO_PREVIEW_WIDTH		320
 #define REC_COMMON_VIDEO_PREVIEW_HEIGHT		240