[Freeswitch-svn] [commit] r7538 - in freeswitch/trunk/src: include mod/applications/mod_conference mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Wed Feb 6 19:04:14 EST 2008


Author: anthm
Date: Wed Feb  6 19:04:14 2008
New Revision: 7538

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c

Log:
add video update req thingybob

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Wed Feb  6 19:04:14 2008
@@ -436,6 +436,7 @@
 	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 @@
 	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;
 
 

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Wed Feb  6 19:04:14 2008
@@ -736,7 +736,7 @@
 	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 @@
 			
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
 				conference->floor_holder = NULL;
+				req_iframe = 0;
 				continue;
 			}
 			
@@ -759,9 +760,23 @@
 				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 @@
 				if (!iframe) {
 					continue;
 				}
+
+				req_iframe = 0;
 			}
 
 			last_member = conference->floor_holder;
@@ -1500,7 +1517,8 @@
 						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");

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Wed Feb  6 19:04:14 2008
@@ -712,6 +712,27 @@
 	}
 
 	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);



More information about the Freeswitch-svn mailing list