diff --git a/daemon/codec.c b/daemon/codec.c index 12d07b34e..a1acec066 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -37,9 +37,9 @@ struct mqtt_timer { }; struct timer_callback { struct codec_timer ct; - void (*timer_callback_func)(call_t *, void *); + void (*timer_callback_func)(call_t *, codec_timer_callback_arg_t); call_t *call; - void *ptr; + codec_timer_callback_arg_t arg; }; typedef void (*raw_input_func_t)(struct media_packet *mp, unsigned int); @@ -5638,16 +5638,18 @@ static void __codec_timer_callback_free(void *p) { static void __codec_timer_callback_fire(struct codec_timer *ct) { struct timer_callback *cb = (void *) ct; log_info_call(cb->call); - cb->timer_callback_func(cb->call, cb->ptr); + cb->timer_callback_func(cb->call, cb->arg); codec_timer_stop(&ct); log_info_pop(); } -void codec_timer_callback(call_t *c, void (*func)(call_t *, void *), void *p, uint64_t delay) { +void codec_timer_callback(call_t *c, void (*func)(call_t *, codec_timer_callback_arg_t), + codec_timer_callback_arg_t a, uint64_t delay) +{ struct timer_callback *cb = obj_alloc0("codec_timer_callback", sizeof(*cb), __codec_timer_callback_free); cb->ct.tt_obj.tt = &codec_timers_thread; cb->call = obj_get(c); cb->timer_callback_func = func; - cb->ptr = p; + cb->arg = a; cb->ct.timer_func = __codec_timer_callback_fire; cb->ct.next = rtpe_now; timeval_add_usec(&cb->ct.next, delay); diff --git a/daemon/dtmf.c b/daemon/dtmf.c index 7247f1981..ab44188dd 100644 --- a/daemon/dtmf.c +++ b/daemon/dtmf.c @@ -264,8 +264,8 @@ void dtmf_trigger_set(struct call_monologue *ml, enum dtmf_trigger_type trigger_ state->inactive = inactive; } -static void dtmf_trigger_set_block(call_t *c, void *mlp) { - struct call_monologue *ml = mlp; +static void dtmf_trigger_set_block(call_t *c, codec_timer_callback_arg_t a) { + struct call_monologue *ml = a.ml; rwlock_lock_w(&c->master_lock); @@ -290,8 +290,8 @@ static void dtmf_trigger_set_block(call_t *c, void *mlp) { rwlock_unlock_w(&c->master_lock); } -static void dtmf_trigger_unset_block(call_t *c, void *mlp) { - struct call_monologue *ml = mlp; +static void dtmf_trigger_unset_block(call_t *c, codec_timer_callback_arg_t a) { + struct call_monologue *ml = a.ml; ilog(LOG_INFO, "Setting DTMF block mode to %i", ml->block_dtmf_trigger_end); diff --git a/include/codec.h b/include/codec.h index c345a730a..48f75aac0 100644 --- a/include/codec.h +++ b/include/codec.h @@ -89,12 +89,17 @@ struct codec_scheduler { long output_skew; }; +typedef union { + struct call_monologue *ml; +} codec_timer_callback_arg_t __attribute__ ((__transparent_union__)); + void codecs_init(void); void codecs_cleanup(void); void codec_timers_loop(void *); void rtcp_timer_stop(struct rtcp_timer **); -void codec_timer_callback(call_t *, void (*)(call_t *, void *), void *, uint64_t delay); +void codec_timer_callback(call_t *, void (*)(call_t *, codec_timer_callback_arg_t), + codec_timer_callback_arg_t, uint64_t delay); void mqtt_timer_stop(struct mqtt_timer **); void mqtt_timer_start(struct mqtt_timer **mqtp, call_t *call, struct call_media *media);