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