add dynamic buffers

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2583 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-09-08 18:57:24 +00:00
1 parent 4960fbc73f
commit f689b62fb6
9 files changed
+143 -14

No files matched your search

@@ -32,7 +32,8 @@
#ifndef HAVE_CURL
#define HAVE_CURL
#endif
#define JS_BUFFER_SIZE 131072
#define JS_BUFFER_SIZE 1024 * 32
#define JS_BLOCK_SIZE JS_BUFFER_SIZE
#ifdef __ICC
#pragma warning (disable:310 193 1418)
#endif
@@ -2007,7 +2008,7 @@ static JSBool teletone_construct(JSContext *cx, JSObject *obj, uintN argc, jsval
}
}
switch_buffer_create(pool, &tto->audio_buffer, JS_BUFFER_SIZE);
switch_buffer_create_dynamic(&tto->audio_buffer, JS_BLOCK_SIZE, JS_BUFFER_SIZE, 0);
tto->pool = pool;
tto->obj = obj;
tto->cx = cx;
@@ -2027,6 +2028,8 @@ static void teletone_destroy(JSContext *cx, JSObject *obj)
switch_core_timer_destroy(tto->timer);
}
teletone_destroy_session(&tto->ts);
switch_buffer_destroy(&tto->audio_buffer);
switch_buffer_destroy(&tto->loop_buffer);
switch_core_codec_destroy(&tto->codec);
pool = tto->pool;
tto->pool = NULL;
@@ -2088,7 +2091,7 @@ static JSBool teletone_generate(JSContext *cx, JSObject *obj, uintN argc, jsval
}
loops--;
if (!tto->loop_buffer) {
switch_buffer_create(tto->pool, &tto->loop_buffer, JS_BUFFER_SIZE);
switch_buffer_create_dynamic(&tto->loop_buffer, JS_BLOCK_SIZE, JS_BUFFER_SIZE, 0);
}
}