]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7500: video introp tweaks
authorBrian West <brian@freeswitch.org>
Fri, 3 Apr 2015 23:39:43 +0000 (18:39 -0500)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:47:15 +0000 (12:47 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_channel.c
src/switch_core_media.c

index 71a6b8faec46cbf9adcd4c8bc61fba62f8535c8e..6e59403bf0e10f39dc64c6c65c36ef858339cbfc 100644 (file)
@@ -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 = "<?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);
 
                        if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) {
index 41f4ca1c9941536425788a9baeb436f162600c29..127bf13c693f7a6bfb117d5f78cdf0349a83918a 100644 (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");
 
+               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);
index 33d608e649edaa33da891613919a350bf727a04c..24cce05aabd7cdf672d1b370b2ea368635b70d7d 100644 (file)
@@ -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;
        }