@ -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,6 +551,8 @@ 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 ) ;
}
@ -601,15 +603,25 @@ int ast_jb_read_conf(struct ast_jb_conf *conf, char *varname, char *value)
}
void ast_jb_configure ( struct ast_channel * chan , const struct ast_jb_conf * conf )
int ast_jb_configure ( struct ast_channel * chan , const struct ast_jb_conf * conf )
{
memcpy ( & chan - > jb . conf , conf , sizeof ( * conf ) ) ;
if ( ! ( chan - > jb = ast_calloc ( 1 , sizeof ( * chan - > jb ) ) ) )
return - 1 ;
memcpy ( & chan - > jb - > conf , conf , sizeof ( * conf ) ) ;
return 0 ;
}
void ast_jb_get_config ( const struct ast_channel * chan , struct ast_jb_conf * conf )
int ast_jb_get_config ( const struct ast_channel * chan , struct ast_jb_conf * conf )
{
memcpy ( conf , & chan - > jb . conf , sizeof ( * conf ) ) ;
if ( ! chan - > jb )
return - 1 ;
memcpy ( conf , & chan - > jb - > conf , sizeof ( * conf ) ) ;
return 0 ;
}