[Freeswitch-svn] [commit] r4716 - in freeswitch/trunk/src: . include mod/applications/mod_conference

Freeswitch SVN anthm at freeswitch.org
Wed Mar 21 14:50:51 EDT 2007


Author: anthm
Date: Wed Mar 21 14:50:51 2007
New Revision: 4716

Modified:
   freeswitch/trunk/src/include/switch_resample.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/switch_resample.c

Log:
shhhh

Modified: freeswitch/trunk/src/include/switch_resample.h
==============================================================================
--- freeswitch/trunk/src/include/switch_resample.h	(original)
+++ freeswitch/trunk/src/include/switch_resample.h	Wed Mar 21 14:50:51 2007
@@ -155,6 +155,14 @@
 SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len);
 
 /*!
+  \brief Generate static noise
+  \param data the audio data buffer
+  \param samples the number of 2 byte samples
+  \param divisor the volume factor
+ */
+SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor);
+
+/*!
   \brief Change the volume of a signed linear audio frame
   \param data the audio data
   \param samples the number of 2 byte samples

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	Wed Mar 21 14:50:51 2007
@@ -1696,7 +1696,7 @@
 				
 			} else {
 				if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) {
-					memset(write_frame.data, 255, bytes);
+					switch_generate_sln_silence(write_frame.data, samples, 1400);
 					write_frame.datalen = bytes;
 					write_frame.samples = samples;
 					write_frame.timestamp = timer.samplecount;

Modified: freeswitch/trunk/src/switch_resample.c
==============================================================================
--- freeswitch/trunk/src/switch_resample.c	(original)
+++ freeswitch/trunk/src/switch_resample.c	Wed Mar 21 14:50:51 2007
@@ -183,6 +183,27 @@
 	}
 }
 
+SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
+{
+	int16_t rnd, x,i;
+	uint32_t sum_rnd = 0;
+
+	assert(divisor);
+	
+	for(i = 0; i < samples; i++, sum_rnd = 0) {
+		for(x = 0; x < 7; x++) {
+			rnd = (int16_t) (rand() * sizeof(int16_t));
+			sum_rnd += rnd;
+		}
+		switch_normalize_to_16bit(sum_rnd);
+		*data = (int16_t) sum_rnd;
+		*data /= (int)divisor;
+
+		data++;
+	}
+}
+
+
 SWITCH_DECLARE(void) switch_change_sln_volume(int16_t *data, uint32_t samples, int32_t vol)
 {
     double newrate = 0;



More information about the Freeswitch-svn mailing list