[Freeswitch-svn] [commit] r1959 - freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip

Freeswitch SVN stkn at freeswitch.org
Tue Jul 18 15:32:05 EDT 2006


Author: stkn
Date: Tue Jul 18 15:32:05 2006
New Revision: 1959

Modified:
   freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c

Log:
Add RTP I/O fix by anthm.

Modified: freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c
==============================================================================
--- freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c	(original)
+++ freeswitch/branches/stkn/src/mod/endpoints/mod_pjsip/mod_pjsip.c	Tue Jul 18 15:32:05 2006
@@ -597,8 +597,12 @@
 			if( tech_pvt->read_frame.datalen > 0 ) {
 				int samples, bytes, frames;
 
-				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;
 
 				tech_pvt->read_frame.samples = (int)samples;
@@ -637,9 +641,12 @@
 		int samples, frames, bytes;
 
 		assert( tech_pvt->rtp_session != NULL );
-
-		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;
 
 		switch_rtp_write_frame( tech_pvt->rtp_session, frame, samples );
@@ -1318,16 +1325,16 @@
 
 
 	tech_pvt->rtp_session = switch_rtp_new( tech_pvt->local_sdp_audio_addr,
-					   tech_pvt->local_sdp_audio_port,
-					   tech_pvt->remote_sdp_audio_addr,
-					   tech_pvt->remote_sdp_audio_port,
-					   tech_pvt->read_codec.implementation->ianacode,
-					   tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
-					   tech_pvt->read_codec.implementation->microseconds_per_frame / 1000,
-					   flags,
-					   NULL,
-					   &err, switch_core_session_get_pool( tech_pvt->session ) );
-
+									   tech_pvt->local_sdp_audio_port,
+									   tech_pvt->remote_sdp_audio_addr,
+									   tech_pvt->remote_sdp_audio_port,
+									   tech_pvt->read_codec.implementation->ianacode,
+									   0,
+									   tech_pvt->read_codec.implementation->microseconds_per_frame / 1000,
+									   flags,
+									   NULL,
+									   &err, switch_core_session_get_pool( tech_pvt->session ) );
+	
 	if( !tech_pvt->rtp_session ) {
 		switch_channel_hangup( channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER );
 		switch_set_flag( tech_pvt, TFLAG_BYE );



More information about the Freeswitch-svn mailing list