[Freeswitch-branches] [commit] r1962 - in freeswitch/branches/stkn: scripts/rss src src/mod/asr_tts/mod_cepstral src/mod/codecs/mod_speex src/mod/endpoints/mod_dingaling src/mod/endpoints/mod_exosip src/mod/endpoints/mod_iax

Freeswitch SVN stkn at freeswitch.org
Tue Jul 18 21:18:26 EDT 2006


Author: stkn
Date: Tue Jul 18 21:18:25 2006
New Revision: 1962

Added:
   freeswitch/branches/stkn/scripts/rss/syncrss.pl
      - copied unchanged from r1961, /freeswitch/trunk/scripts/rss/syncrss.pl
Modified:
   freeswitch/branches/stkn/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
   freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c
   freeswitch/branches/stkn/src/switch_rtp.c

Log:
Merge changes from trunk.

Modified: freeswitch/branches/stkn/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	(original)
+++ freeswitch/branches/stkn/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	Tue Jul 18 21:18:25 2006
@@ -27,6 +27,12 @@
  *
  *
  * mod_cepstral.c -- Cepstral Interface
+ * 
+ * Contains some material derived from the Cepstral Swift SDK, by  
+ * permission.  You are free to copy and modify the source under the  
+ * terms of FreeSWITCH itself, without additional permission from  
+ * Cepstral
+ * 
  *
  */
 #ifdef __ICC

Modified: freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c	(original)
+++ freeswitch/branches/stkn/src/mod/codecs/mod_speex/mod_speex.c	Tue Jul 18 21:18:25 2006
@@ -202,8 +202,6 @@
 	}
 
 
-
-
 	speex_bits_pack(&context->encoder_bits, 15, 5);
 	*encoded_data_len = speex_bits_write(&context->encoder_bits, (char *) encoded_data, context->encoder_frame_size);
 	speex_bits_reset(&context->encoder_bits);
@@ -226,6 +224,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+
 	buf = decoded_data;
 	if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
 		speex_decode_int(context->decoder_state, NULL, buf);
@@ -276,7 +275,7 @@
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 640,
 	/*.bytes_per_frame */ 1280,
-	/*.encoded_bytes_per_frame */ 43,
+	/*.encoded_bytes_per_frame */ 0,
 	/*.number_of_channels */ 1,
 	/*.pref_frames_per_packet */ 1,
 	/*.max_frames_per_packet */ 1,
@@ -295,7 +294,7 @@
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 320,
 	/*.bytes_per_frame */ 640,
-	/*.encoded_bytes_per_frame */ 43,
+	/*.encoded_bytes_per_frame */ 0,
 	/*.number_of_channels */ 1,
 	/*.pref_frames_per_packet */ 1,
 	/*.max_frames_per_packet */ 1,
@@ -315,7 +314,7 @@
 	/*.nanoseconds_per_frame */ 20000,
 	/*.samples_per_frame */ 160,
 	/*.bytes_per_frame */ 320,
-	/*.encoded_bytes_per_frame */ 29,
+	/*.encoded_bytes_per_frame */ 0,
 	/*.number_of_channels */ 1,
 	/*.pref_frames_per_packet */ 1,
 	/*.max_frames_per_packet */ 1,

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Tue Jul 18 21:18:25 2006
@@ -291,15 +291,15 @@
 	}
 
 	if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
-						     tech_pvt->local_port,
-						     tech_pvt->remote_ip,
-						     tech_pvt->remote_port,
-						     tech_pvt->codec_num,
-						     tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
-						     tech_pvt->read_codec.implementation->microseconds_per_frame,
-						     flags,
-						     NULL,
-						     &err, switch_core_session_get_pool(tech_pvt->session)))) {
+												 tech_pvt->local_port,
+												 tech_pvt->remote_ip,
+												 tech_pvt->remote_port,
+												 tech_pvt->codec_num,
+												 0,
+												 tech_pvt->read_codec.implementation->microseconds_per_frame,
+												 flags,
+												 NULL,
+												 &err, switch_core_session_get_pool(tech_pvt->session)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		return -1;
@@ -784,8 +784,12 @@
 		}
 
 		if (tech_pvt->read_frame.datalen > 0) {
-			bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-			frames = (tech_pvt->read_frame.datalen / bytes);
+			if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
+				bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+				frames = (tech_pvt->read_frame.datalen / bytes);
+			} else {
+				frames = 1;
+			}
 			samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
 			ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
 			tech_pvt->timestamp_recv += (int32_t) samples;
@@ -841,9 +845,13 @@
 
 	switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
 
+	if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
+		bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+		frames = ((int) frame->datalen / bytes);
+	} else {
+		frames = 1;
+	}
 
-	bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-	frames = ((int) frame->datalen / bytes);
 	samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
 
 	//printf("%s send %d bytes %d samples in %d frames ts=%d\n", switch_channel_get_name(channel), frame->datalen, samples, frames, tech_pvt->timestamp_send);

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_exosip/mod_exosip.c	Tue Jul 18 21:18:25 2006
@@ -562,7 +562,7 @@
 										   tech_pvt->remote_sdp_audio_ip,
 										   tech_pvt->remote_sdp_audio_port,
 										   tech_pvt->read_codec.implementation->ianacode,
-										   tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
+										   0, //tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
 										   ms,
 										   flags,
 										   key,
@@ -718,8 +718,12 @@
 
 			if (tech_pvt->read_frame.datalen > 0) {
 				tech_pvt->last_read = switch_time_now();
-				bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-				frames = (tech_pvt->read_frame.datalen / bytes);
+				if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
+					bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+					frames = (tech_pvt->read_frame.datalen / bytes);
+				} else {
+					frames = 1;
+				}
 				samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
 				ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
 				tech_pvt->timestamp_recv += (int32_t) samples;
@@ -776,8 +780,12 @@
 	switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
 
 	if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
-		bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-		frames = ((int) frame->datalen / bytes);
+		if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
+			bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+			frames = ((int) frame->datalen / bytes);
+		} else {
+			frames = 1;
+		}
 		samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
 	} else {
 		assert(0);

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_iax/mod_iax.c	Tue Jul 18 21:18:25 2006
@@ -129,6 +129,7 @@
 {AST_FORMAT_SLINEAR, 10, "slinear"},
 {AST_FORMAT_LPC10, 7, "lpc10"},
 {AST_FORMAT_G729A, 18, "g729"},
+{AST_FORMAT_SPEEX, 97, "speex"},
 {AST_FORMAT_SPEEX, 98, "speex"},
 {AST_FORMAT_ILBC, 102, "ilbc"},
 {AST_FORMAT_MAX_AUDIO, 999, ""},
@@ -1098,8 +1099,12 @@
 							break;
 						}
 
-						bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
-						frames = (int) (tech_pvt->read_frame.datalen / bytes);
+						if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
+							bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+							frames = (int) (tech_pvt->read_frame.datalen / bytes);
+						} else {
+							frames = 1;
+						}
 
 
 						tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;

Modified: freeswitch/branches/stkn/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/stkn/src/switch_rtp.c	(original)
+++ freeswitch/branches/stkn/src/switch_rtp.c	Tue Jul 18 21:18:25 2006
@@ -796,10 +796,11 @@
 				
 					switch_sockaddr_ip_get(&tx_host, rtp_session->from_addr);
 					switch_sockaddr_ip_get(&old_host, rtp_session->remote_addr);
-					
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",
-									  old_host, old, tx_host, rtp_session->from_addr->port);
-					switch_rtp_set_remote_address(rtp_session, tx_host, rtp_session->from_addr->port, &err);
+					if (!switch_strlen_zero(tx_host) && rtp_session->from_addr->port > 0) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",
+										  old_host, old, tx_host, rtp_session->from_addr->port);
+						switch_rtp_set_remote_address(rtp_session, tx_host, rtp_session->from_addr->port, &err);
+					}
 				}
 				switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 			}
@@ -1083,7 +1084,8 @@
 	
 	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) && 
 		rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode &&
-		datalen == rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame) {
+		((datalen == rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame) || 
+		 (datalen > SWITCH_RTP_CNG_PAYLOAD && rtp_session->vad_data.read_codec->implementation->encoded_bytes_per_frame == 0))) {
 		int16_t decoded[SWITCH_RECCOMMENDED_BUFFER_SIZE/sizeof(int16_t)];
 		uint32_t rate;
 		uint32_t flags;



More information about the Freeswitch-branches mailing list