revert my changes that converted the jb on the channel to be dynamically

allocated. These changes caused crashes when using a channel type that did
not support the jitterbuffer. Instead of fixing why it's crashing, I'm going
to implement this in a better way next week. The way I did it caused a
jitterbuffer to be allocated on every channel where the channel type supported
jitterbuffers, even if they were disabled.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35746 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-06-23 16:49:12 +00:00
parent b8518110da
commit c8ceb92a4f
12 changed files with 79 additions and 138 deletions

View File

@@ -176,7 +176,7 @@ static long get_now(struct ast_jb *jb, struct timeval *tv);
static void jb_choose_impl(struct ast_channel *chan)
{
struct ast_jb *jb = chan->jb;
struct ast_jb *jb = &chan->jb;
struct ast_jb_conf *jbconf = &jb->conf;
struct ast_jb_impl *test_impl;
int i, avail_impl_count = sizeof(avail_impl) / sizeof(avail_impl[0]);
@@ -197,8 +197,8 @@ static void jb_choose_impl(struct ast_channel *chan)
int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
{
struct ast_jb *jb0 = c0->jb;
struct ast_jb *jb1 = c1->jb;
struct ast_jb *jb0 = &c0->jb;
struct ast_jb *jb1 = &c1->jb;
struct ast_jb_conf *conf0 = &jb0->conf;
struct ast_jb_conf *conf1 = &jb1->conf;
int c0_wants_jitter = c0->tech->properties & AST_CHAN_TP_WANTSJITTER;
@@ -258,8 +258,8 @@ int ast_jb_do_usecheck(struct ast_channel *c0, struct ast_channel *c1)
int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, int time_left)
{
struct ast_jb *jb0 = c0->jb;
struct ast_jb *jb1 = c1->jb;
struct ast_jb *jb0 = &c0->jb;
struct ast_jb *jb1 = &c1->jb;
int c0_use_jb = ast_test_flag(jb0, JB_USE);
int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
int c1_use_jb = ast_test_flag(jb1, JB_USE);
@@ -298,7 +298,7 @@ int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, in
int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
{
struct ast_jb *jb = chan->jb;
struct ast_jb *jb = &chan->jb;
struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *frr;
@@ -366,8 +366,8 @@ int ast_jb_put(struct ast_channel *chan, struct ast_frame *f)
void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
{
struct ast_jb *jb0 = c0->jb;
struct ast_jb *jb1 = c1->jb;
struct ast_jb *jb0 = &c0->jb;
struct ast_jb *jb1 = &c1->jb;
int c0_use_jb = ast_test_flag(jb0, JB_USE);
int c0_jb_is_created = ast_test_flag(jb0, JB_CREATED);
int c1_use_jb = ast_test_flag(jb1, JB_USE);
@@ -383,7 +383,7 @@ void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1)
static void jb_get_and_deliver(struct ast_channel *chan)
{
struct ast_jb *jb = chan->jb;
struct ast_jb *jb = &chan->jb;
struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f, finterp;
@@ -447,7 +447,7 @@ static void jb_get_and_deliver(struct ast_channel *chan)
static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
{
struct ast_jb *jb = chan->jb;
struct ast_jb *jb = &chan->jb;
struct ast_jb_conf *jbconf = &jb->conf;
struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj;
@@ -527,7 +527,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr)
void ast_jb_destroy(struct ast_channel *chan)
{
struct ast_jb *jb = chan->jb;
struct ast_jb *jb = &chan->jb;
struct ast_jb_impl *jbimpl = jb->impl;
void *jbobj = jb->jbobj;
struct ast_frame *f;
@@ -551,8 +551,6 @@ void ast_jb_destroy(struct ast_channel *chan)
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "%s jitterbuffer destroyed on channel %s\n", jbimpl->name, chan->name);
}
free(jb);
}
@@ -603,25 +601,15 @@ int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value)
}
int ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
void ast_jb_configure(struct ast_channel *chan, const struct ast_jb_conf *conf)
{
if (!(chan->jb = ast_calloc(1, sizeof(*chan->jb))))
return -1;
memcpy(&chan->jb->conf, conf, sizeof(*conf));
return 0;
memcpy(&chan->jb.conf, conf, sizeof(*conf));
}
int ast_jb_get_config(const struct ast_channel *chan, struct ast_jb_conf *conf)
void ast_jb_get_config(const struct ast_channel *chan, struct ast_jb_conf *conf)
{
if (!chan->jb)
return -1;
memcpy(conf, &chan->jb->conf, sizeof(*conf));
return 0;
memcpy(conf, &chan->jb.conf, sizeof(*conf));
}