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

Freeswitch SVN anthm at freeswitch.org
Mon Feb 4 17:38:02 EST 2008


Author: anthm
Date: Mon Feb  4 17:38:01 2008
New Revision: 7520

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
update

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	Mon Feb  4 17:38:01 2008
@@ -735,10 +735,11 @@
 	conference_member_t *imember, *last_member = NULL;
 	switch_frame_t *vid_frame;
 	switch_status_t status;
+	int skip = 0, has_vid = 1;
 
 	conference->video_running = 1;
 
-	while (conference->video_running == 1 && globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
+	while (has_vid && conference->video_running == 1 && globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
 		if (!conference->floor_holder) {
 			switch_yield(100000);
 			continue;
@@ -752,23 +753,34 @@
 				continue;
 			}
 			
-			if (last_member != conference->floor_holder && vid_frame->datalen < 1000) {
+			if (switch_test_flag(vid_frame, SFF_CNG)) {
 				continue;
-			}		
+			}
+
+			if (last_member != conference->floor_holder && vid_frame->datalen < 1000) {
+				skip = 1000;
+			}
 
-			switch_mutex_lock(conference->member_mutex);	
 			last_member = conference->floor_holder;
 			
+			if (skip && vid_frame->datalen >= skip) {
+				skip = 0;
+			}
+
+			if (skip) {
+				continue;
+			}
+			
+			switch_mutex_lock(conference->member_mutex);	
+			has_vid = 0;
 			for (imember = conference->members; imember; imember = imember->next) {
 				if (switch_channel_test_flag(switch_core_session_get_channel(imember->session), CF_VIDEO)) {
+					has_vid++;
 					switch_core_session_write_video_frame(imember->session, vid_frame, -1, 0);
 				}
 			}
 			switch_mutex_unlock(conference->member_mutex);
 		}
-
-		
-
 	}
 
 	conference->video_running = 0;
@@ -1627,10 +1639,6 @@
 	/* Start the input thread */
 	launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
 
-	if (switch_channel_test_flag(channel, CF_VIDEO) && member->conference->video_running != 1) {
-		launch_conference_video_thread(member->conference);
-	}
-
 	/* build a digit stream object */
 	if (member->conference->dtmf_parser != NULL
 		&& switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
@@ -1675,8 +1683,15 @@
             switch_size_t file_sample_len = csamples;
             switch_size_t file_data_len = file_sample_len * 2;
 
+			
+			if (switch_channel_test_flag(channel, CF_VIDEO) && member->conference->video_running != 1) {
+				launch_conference_video_thread(member->conference);
+			}
+			
+
 			switch_mutex_lock(member->flag_mutex);
 
+
 			if (switch_core_session_dequeue_event(member->session, &event) == SWITCH_STATUS_SUCCESS) {
 				char *from = switch_event_get_header(event, "from");
 				char *to = switch_event_get_header(event, "to");

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Mon Feb  4 17:38:01 2008
@@ -404,20 +404,29 @@
 switch_status_t sofia_glue_ext_address_lookup(char **ip, switch_port_t *port, char *sourceip, switch_memory_pool_t *pool)
 {
 	char *error;
+	switch_status_t status;
+	int x;
 
 	if (!sourceip) {
 		return SWITCH_STATUS_FALSE;
 	}
 
 	if (!strncasecmp(sourceip, "stun:", 5)) {
-		char *stun_ip = sourceip + 5;
-		if (!stun_ip) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER\n");
-			return SWITCH_STATUS_FALSE;
+		for (x = 0; x < 5; x++) {
+			char *stun_ip = sourceip + 5;
+			if (!stun_ip) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! NO STUN SERVER\n");
+				return SWITCH_STATUS_FALSE;
+			}
+			if ((status = switch_stun_lookup(ip, port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &error, pool)) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, error);
+				switch_yield(100000);
+			} else {
+				break;
+			}
 		}
-		if (switch_stun_lookup(ip, port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &error, pool) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, error);
-			return SWITCH_STATUS_FALSE;
+		if (status != SWITCH_STATUS_SUCCESS) {
+			return status;
 		}
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stun Success [%s]:[%d]\n", *ip, *port);
 	} else {



More information about the Freeswitch-svn mailing list