[Freeswitch-svn] [commit] r9246 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Mon Aug 11 16:41:19 EDT 2008


Author: anthm
Date: Mon Aug 11 16:41:18 2008
New Revision: 9246

Modified:
   freeswitch/trunk/src/include/switch_resample.h
   freeswitch/trunk/src/switch_ivr_originate.c
   freeswitch/trunk/src/switch_resample.c

Log:
fix resampled file in ringback issue from mailing list

Modified: freeswitch/trunk/src/include/switch_resample.h
==============================================================================
--- freeswitch/trunk/src/include/switch_resample.h	(original)
+++ freeswitch/trunk/src/include/switch_resample.h	Mon Aug 11 16:41:18 2008
@@ -60,6 +60,7 @@
 	int to_rate;
 	/*! the factor to resample by (from / to) */
 	double factor;
+	double rfactor;
 	/*! a pointer to store a float buffer for data to be resampled */
 	float *from;
 	/*! the size of the from buffer used */

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Mon Aug 11 16:41:18 2008
@@ -420,6 +420,9 @@
 				}
 
 				olen = mlen;
+				if (ringback.fh->resampler) {
+					olen *= ringback.fh->resampler->rfactor;
+				}
 				switch_core_file_read(ringback.fh, write_frame.data, &olen);
 
 				if (olen == 0) {
@@ -1200,6 +1203,10 @@
 							}
 
 							olen = mlen;
+							if (ringback.fh->resampler) {
+								olen *= ringback.fh->resampler->rfactor;
+							}
+							
 							switch_core_file_read(ringback.fh, write_frame.data, &olen);
 
 							if (olen == 0) {

Modified: freeswitch/trunk/src/switch_resample.c
==============================================================================
--- freeswitch/trunk/src/switch_resample.c	(original)
+++ freeswitch/trunk/src/switch_resample.c	Mon Aug 11 16:41:18 2008
@@ -72,6 +72,7 @@
 	lto_rate = (double) resampler->to_rate;
 	lfrom_rate = (double) resampler->from_rate;
 	resampler->factor = (lto_rate / lfrom_rate);
+	resampler->rfactor = (lfrom_rate / lto_rate);
 
 	resampler->resampler = resample_open(QUALITY, resampler->factor, resampler->factor);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Activate Resampler %d->%d %f\n", resampler->from_rate, resampler->to_rate,



More information about the Freeswitch-svn mailing list