[Freeswitch-svn] [commit] r7639 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/endpoints/mod_portaudio mod/formats/mod_local_stream

Freeswitch SVN mikej at freeswitch.org
Fri Feb 15 18:02:06 EST 2008


Author: mikej
Date: Fri Feb 15 18:02:06 2008
New Revision: 7639

Modified:
   freeswitch/trunk/src/include/switch_utils.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
   freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
   freeswitch/trunk/src/switch_core_speech.c
   freeswitch/trunk/src/switch_ivr.c

Log:
switch_bytes_per_frame -> switch_samples_per_frame rename

Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h	(original)
+++ freeswitch/trunk/src/include/switch_utils.h	Fri Feb 15 18:02:06 2008
@@ -41,7 +41,7 @@
 #include <switch.h>
 
 SWITCH_BEGIN_EXTERN_C
-#define switch_bytes_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
+#define switch_samples_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
 #define SWITCH_SMAX 32767
 #define SWITCH_SMIN -32768
 #define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2;

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	Fri Feb 15 18:02:06 2008
@@ -817,7 +817,7 @@
 {
 	conference_obj_t *conference = (conference_obj_t *) obj;
 	conference_member_t *imember, *omember;
-	uint32_t samples = switch_bytes_per_frame(conference->rate, conference->interval);
+	uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
 	uint32_t bytes = samples * 2;
 	uint8_t ready = 0, total = 0;
 	switch_timer_t timer = { 0 };
@@ -1647,7 +1647,7 @@
 	switch_timer_t timer = { 0 };
 	switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
 	uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000;
-	uint32_t samples = switch_bytes_per_frame(member->conference->rate, interval);
+	uint32_t samples = switch_samples_per_frame(member->conference->rate, interval);
     uint32_t csamples = samples;
 	uint32_t tsamples = member->orig_read_codec->implementation->samples_per_frame;
 	uint32_t flush_len = 0;
@@ -1656,7 +1656,7 @@
     
 	switch_assert(member->conference != NULL);
 
-	flush_len = switch_bytes_per_frame(member->conference->rate, member->conference->interval) * 10;
+	flush_len = switch_samples_per_frame(member->conference->rate, member->conference->interval) * 10;
 
 	if (switch_core_timer_init(&timer, member->conference->timer_name, interval, tsamples, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed.  Conference Cannot Start\n");
@@ -1952,7 +1952,7 @@
 	conference_member_t smember = { 0 }, *member;
 	conference_record_t *rec = (conference_record_t *) obj;
 	conference_obj_t *conference = rec->conference;
-	uint32_t samples = switch_bytes_per_frame(conference->rate, conference->interval);
+	uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
 	uint32_t low_count = 0, mux_used;
 	char *vval;
 	switch_timer_t timer = { 0 };

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Fri Feb 15 18:02:06 2008
@@ -733,7 +733,7 @@
 	globals.read_frame.buflen = sizeof(globals.databuf);
 	globals.cng_frame.data = globals.cngbuf;
 	globals.cng_frame.buflen = sizeof(globals.cngbuf);
-	globals.cng_frame.datalen = switch_bytes_per_frame(globals.sample_rate, globals.codec_ms) * 2;
+	globals.cng_frame.datalen = switch_samples_per_frame(globals.sample_rate, globals.codec_ms) * 2;
 	switch_set_flag((&globals.cng_frame), SFF_CNG);
 
 	/* connect my internal structure to the blank pointer passed to me */

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	Fri Feb 15 18:02:06 2008
@@ -176,7 +176,7 @@
 			}
 			
 			source->rate = fh.samplerate;
-			source->samples = switch_bytes_per_frame(fh.native_rate, source->interval);
+			source->samples = switch_samples_per_frame(fh.native_rate, source->interval);
 			
 			if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
@@ -425,7 +425,7 @@
 			}
 		}
 		
-		source->samples = switch_bytes_per_frame(source->rate, source->interval);
+		source->samples = switch_samples_per_frame(source->rate, source->interval);
 
 		switch_core_hash_insert(globals.source_hash, source->name, source);
 		

Modified: freeswitch/trunk/src/switch_core_speech.c
==============================================================================
--- freeswitch/trunk/src/switch_core_speech.c	(original)
+++ freeswitch/trunk/src/switch_core_speech.c	Fri Feb 15 18:02:06 2008
@@ -81,7 +81,7 @@
 
 	sh->rate = rate;
 	sh->name = switch_core_strdup(pool, module_name);
-	sh->samples = switch_bytes_per_frame(rate, interval);
+	sh->samples = switch_samples_per_frame(rate, interval);
 
 	return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
 }

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Fri Feb 15 18:02:06 2008
@@ -1518,7 +1518,7 @@
 
 	read_codec = switch_core_session_get_read_codec(session);
 	interval = read_codec->implementation->microseconds_per_frame / 1000;
-	samples = switch_bytes_per_frame(read_codec->implementation->samples_per_second, interval);
+	samples = switch_samples_per_frame(read_codec->implementation->samples_per_second, interval);
 
 	qlen = delay_ms / (interval);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);



More information about the Freeswitch-svn mailing list