FS-7500: video introp tweaks

This commit is contained in:
Brian West 2015-04-03 18:39:43 -05:00 committed by Michael Jerris
parent 0f3b3752d2
commit 379950f523
3 changed files with 21 additions and 12 deletions

View File

@ -1292,10 +1292,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
switch (msg->message_id) { switch (msg->message_id) {
#if 0 #if 1
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ: case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
{ {
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>"; //const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
time_t now = switch_epoch_time_now(NULL); time_t now = switch_epoch_time_now(NULL);
if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) { if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) {

View File

@ -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"); 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) { if (channel->caller_profile && channel->caller_profile->times) {
switch_mutex_lock(channel->profile_mutex); switch_mutex_lock(channel->profile_mutex);
channel->caller_profile->times->progress_media = switch_micro_time_now(); 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_check_zrtp(channel);
switch_channel_set_flag(channel, CF_ANSWERED); 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) { if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_ANSWER) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event); switch_channel_event_set_data(channel, event);

View File

@ -4655,15 +4655,15 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
switch_status_t status; switch_status_t status;
switch_frame_t *read_frame; switch_frame_t *read_frame;
switch_media_handle_t *smh; 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 }; switch_frame_t fr = { 0 };
unsigned char *buf = NULL; unsigned char *buf = NULL;
switch_image_t *blank_img = NULL; switch_image_t *blank_img = NULL;
switch_rgb_color_t bgcolor; switch_rgb_color_t bgcolor;
switch_rtp_engine_t *v_engine = NULL; switch_rtp_engine_t *v_engine = NULL;
switch_color_set_rgb(&bgcolor, "#000000"); switch_color_set_rgb(&bgcolor, "#0000FF");
blank_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 320, 240, 1); 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); switch_img_fill(blank_img, 0, 0, blank_img->d_w, blank_img->d_h, &bgcolor);
if (!(smh = session->media_handle)) { if (!(smh = session->media_handle)) {
@ -4756,12 +4756,10 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
continue; continue;
} }
if (read_frame->img) { if (read_frame->img && read_frame->img->d_w && read_frame->img->d_h) {
if (++viloops > 10) { switch_channel_set_flag(channel, CF_VIDEO_READY);
switch_channel_set_flag(channel, CF_VIDEO_READY); smh->vid_params.width = read_frame->img->d_w;
smh->vid_params.width = read_frame->img->d_w; smh->vid_params.height = read_frame->img->d_h;
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 && if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width &&
switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) && switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) &&
(smh->vid_params.width * smh->vid_params.height) < (img->d_w * img->d_h)) { (smh->vid_params.width * smh->vid_params.height) < (img->d_w * img->d_h)) {
switch_img_copy(img, &dup_img); switch_img_copy(img, &dup_img);
switch_img_fit(&dup_img, smh->vid_params.width, smh->vid_params.height); switch_img_fit(&dup_img, smh->vid_params.width, smh->vid_params.height);
img = dup_img; img = dup_img;
} }