From 379950f5230bd2bd8288d7d1d60b6e5fc1a358b7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 3 Apr 2015 18:39:43 -0500 Subject: [PATCH] FS-7500: video introp tweaks --- src/mod/endpoints/mod_sofia/mod_sofia.c | 5 +++-- src/switch_channel.c | 9 +++++++++ src/switch_core_media.c | 19 +++++++++---------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 71a6b8faec..6e59403bf0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1292,10 +1292,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch (msg->message_id) { -#if 0 +#if 1 case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ: { - const char *pl = "\n\n\n\n\n\n\n\n"; + //const char *pl = "\n\n\n\n\n\n\n\n"; + const char *pl = "\n\n"; time_t now = switch_epoch_time_now(NULL); if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) { diff --git a/src/switch_channel.c b/src/switch_channel.c index 41f4ca1c99..127bf13c69 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3381,6 +3381,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA"); + if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) { + switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT); + } + if (channel->caller_profile && channel->caller_profile->times) { switch_mutex_lock(channel->profile_mutex); channel->caller_profile->times->progress_media = switch_micro_time_now(); @@ -3651,6 +3655,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_channel_check_zrtp(channel); switch_channel_set_flag(channel, CF_ANSWERED); + if (switch_true(switch_channel_get_variable(channel, "video_mirror_input"))) { + switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT); + //switch_channel_set_flag(channel, CF_VIDEO_DECODED_READ); + } + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_ANSWER) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 33d608e649..24cce05aab 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4655,15 +4655,15 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi switch_status_t status; switch_frame_t *read_frame; switch_media_handle_t *smh; - uint32_t loops = 0, xloops = 0, vloops = 0, viloops = 0; + uint32_t loops = 0, xloops = 0, vloops = 0; switch_frame_t fr = { 0 }; unsigned char *buf = NULL; switch_image_t *blank_img = NULL; switch_rgb_color_t bgcolor; switch_rtp_engine_t *v_engine = NULL; - switch_color_set_rgb(&bgcolor, "#000000"); - blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 320, 240, 1); + switch_color_set_rgb(&bgcolor, "#0000FF"); + blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 352, 288, 1); switch_img_fill(blank_img, 0, 0, blank_img->d_w, blank_img->d_h, &bgcolor); if (!(smh = session->media_handle)) { @@ -4756,12 +4756,10 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi continue; } - if (read_frame->img) { - if (++viloops > 10) { - switch_channel_set_flag(channel, CF_VIDEO_READY); - smh->vid_params.width = read_frame->img->d_w; - smh->vid_params.height = read_frame->img->d_h; - } + if (read_frame->img && read_frame->img->d_w && read_frame->img->d_h) { + switch_channel_set_flag(channel, CF_VIDEO_READY); + smh->vid_params.width = read_frame->img->d_w; + smh->vid_params.height = read_frame->img->d_h; } } @@ -10212,9 +10210,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width && switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) && (smh->vid_params.width * smh->vid_params.height) < (img->d_w * img->d_h)) { - + switch_img_copy(img, &dup_img); switch_img_fit(&dup_img, smh->vid_params.width, smh->vid_params.height); + img = dup_img; }