a whole bunch of stuff just to avoid a sonus issue silence_when_idle=400 chanvar to send generated silence duing sleeps etc

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10664 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2008-12-09 00:32:51 +00:00
parent 2ac1b96b29
commit 1136fcec4a
5 changed files with 178 additions and 20 deletions

View File

@@ -203,18 +203,19 @@ SWITCH_DECLARE(void) switch_swap_linear(int16_t *buf, int len)
SWITCH_DECLARE(void) switch_generate_sln_silence(int16_t *data, uint32_t samples, uint32_t divisor)
{
int16_t rnd = 0, rnd2, x;
int16_t x;
uint32_t i;
int sum_rnd = 0;
int16_t rnd2 = (int16_t) switch_timestamp_now();
assert(divisor);
rnd2 = (int16_t) (intptr_t) &data + (int16_t)switch_timestamp(NULL);
for (i = 0; i < samples; i++, sum_rnd = 0) {
for (x = 0; x < 10; x++) {
rnd += (int16_t)((x + i) * rnd2);
sum_rnd += rnd;
for (x = 0; x < 6; x++) {
rnd2 = rnd2 * 31821U + 13849U;
sum_rnd += rnd2;
}
switch_normalize_to_16bit(sum_rnd);
*data = (int16_t) ((int16_t) sum_rnd / (int) divisor);