diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-23 16:49:12 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-23 16:49:12 +0000 |
commit | 604972725d6443e145cc1344d5b91a94f3a6874d (patch) | |
tree | 9df57ec67d82e432a214c23cd83cc42f9889c78f /abstract_jb.c | |
parent | 782273ca463cc47bf63cb11429ce97e49fcac58f (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@35746 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'abstract_jb.c')
-rw-r--r-- | abstract_jb.c | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/abstract_jb.c b/abstract_jb.c index e9ab1ad9c..1525d81b0 100644 --- a/abstract_jb.c +++ b/abstract_jb.c @@ -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)); } |