]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add video update req thingybob
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 7 Feb 2008 00:04:14 +0000 (00:04 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 7 Feb 2008 00:04:14 +0000 (00:04 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7538 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/mod/applications/mod_conference/mod_conference.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index 112c38774831e0ecf83bf7fcd46ffc83c7345a75..dc0c08ec100831517c0ceb93d7ae07a2474fbb01 100644 (file)
@@ -436,6 +436,7 @@ typedef enum {
        SWITCH_MESSAGE_INDICATE_BROADCAST - indicate media broadcast
        SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT - indicate media broadcast
        SWITCH_MESSAGE_INDICATE_DEFLECT - indicate deflect
+       SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ - indicate video refresh request
 </pre>
  */
 typedef enum {
@@ -455,7 +456,8 @@ typedef enum {
        SWITCH_MESSAGE_INDICATE_RESPOND,
        SWITCH_MESSAGE_INDICATE_BROADCAST,
        SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
-       SWITCH_MESSAGE_INDICATE_DEFLECT
+       SWITCH_MESSAGE_INDICATE_DEFLECT,
+       SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ
 } switch_core_session_message_types_t;
 
 
index 53dca94fc0c6e7c865f0e2f25712786b2416a595..814cefc35c3b477d81ce394672eb660d826b1383 100644 (file)
@@ -736,7 +736,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
        conference_member_t *imember, *last_member = NULL;
        switch_frame_t *vid_frame;
        switch_status_t status;
-       int has_vid = 1;
+       int has_vid = 1, req_iframe = 0;
        
        conference->video_running = 1;
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video thread started for conference %s\n", conference->name);
@@ -752,6 +752,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
                        
                        if (!SWITCH_READ_ACCEPTABLE(status)) {
                                conference->floor_holder = NULL;
+                               req_iframe = 0;
                                continue;
                        }
                        
@@ -759,9 +760,23 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
                                continue;
                        }
 
+                       if (!conference->floor_holder) {
+                               req_iframe = 0;
+                               continue;
+                       }
+
                        if (conference->floor_holder != last_member) {
                                int iframe = 0;
-       
+                               switch_core_session_message_t msg = { 0 };
+
+                               if (!req_iframe) {
+                                       /* Tell the channel to request a fresh vid frame */
+                                       msg.from = __FILE__;
+                                       msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ;
+                                       switch_core_session_receive_message(conference->floor_holder->session, &msg);
+                                       req_iframe = 1;
+                               }
+                               
                                if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */
                                        iframe = (*((int16_t*)vid_frame->data) >> 12 == 6);
                                } else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */
@@ -776,6 +791,8 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr
                                if (!iframe) {
                                        continue;
                                }
+
+                               req_iframe = 0;
                        }
 
                        last_member = conference->floor_holder;
@@ -1500,7 +1517,8 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread,
                                                switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
                                                switch_mutex_lock(member->conference->member_mutex);
                                                if (!member->conference->floor_holder || 
-                                                       !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score > member->conference->floor_holder->score) {
+                                                       !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score > 
+                                                       member->conference->floor_holder->score + 200) {
                                                        if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
                                                                conference_add_event_member_data(member, event);
                                                                switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change");
index c41aa09f56274b962827fe19a5277e10c9c96951..e96b54eea8f2daea29b3f80df985207443e8b1b7 100644 (file)
@@ -712,6 +712,27 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
        }
 
        switch (msg->message_id) {
+       case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
+               {
+                       const char *pl =
+                               "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"
+                               " <media_control>\r\n"
+                               "  <vc_primitive>\r\n"
+                               "   <to_encoder>\r\n"
+                               "    <picture_fast_update>\r\n"
+                               "    </picture_fast_update>\r\n"
+                               "   </to_encoder>\r\n"
+                               "  </vc_primitive>\r\n"
+                               " </media_control>\r\n";
+                       
+                       nua_info(tech_pvt->nh,
+                                        SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"),
+                                        SIPTAG_PAYLOAD_STR(pl),
+                                        TAG_END());
+
+                       
+               }
+               break;
        case SWITCH_MESSAGE_INDICATE_BROADCAST: {
                const char *ip = NULL, *port = NULL;
                ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);