diff --git a/daemon/call.c b/daemon/call.c index dfbd737e6..49606f81d 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -90,7 +90,6 @@ static struct timeval add_ongoing_calls_dur_in_interval(struct timeval *interval static void __call_free(void *p); static void __call_cleanup(struct call *c); static void __monologue_stop(struct call_monologue *ml); -static void __dialogue_unkernelize(struct call_monologue *ml); static void media_stop(struct call_media *m); /* called with call->master_lock held in R */ @@ -2998,8 +2997,8 @@ int monologue_subscribe_answer(struct call_monologue *dst_ml, struct sdp_ng_flag __update_init_subscribers(dst_ml, streams, flags); __update_init_subscribers(src_ml, NULL, NULL); - __dialogue_unkernelize(src_ml); - __dialogue_unkernelize(dst_ml); + dialogue_unkernelize(src_ml); + dialogue_unkernelize(dst_ml); return 0; } @@ -3016,8 +3015,8 @@ int monologue_unsubscribe(struct call_monologue *dst_ml, struct sdp_ng_flags *fl __update_init_subscribers(dst_ml, NULL, NULL); __update_init_subscribers(src_ml, NULL, NULL); - __dialogue_unkernelize(src_ml); - __dialogue_unkernelize(dst_ml); + dialogue_unkernelize(src_ml); + dialogue_unkernelize(dst_ml); l = next; } @@ -3635,7 +3634,7 @@ void __monologue_unkernelize(struct call_monologue *monologue) { } } } -static void __dialogue_unkernelize(struct call_monologue *ml) { +void dialogue_unkernelize(struct call_monologue *ml) { __monologue_unkernelize(ml); for (GList *sub = ml->subscriptions.head; sub; sub = sub->next) { @@ -3925,14 +3924,14 @@ tag_setup: if (!ft->tag.s || str_cmp_str(&ft->tag, fromtag)) __monologue_tag(ft, fromtag); - __dialogue_unkernelize(ft); - __dialogue_unkernelize(tt); + dialogue_unkernelize(ft); + dialogue_unkernelize(tt); __subscribe_offer_answer_both_ways(ft, tt); __fix_other_tags(ft); done: __monologue_unkernelize(ft); - __dialogue_unkernelize(ft); + dialogue_unkernelize(ft); dialogue[0] = ft; dialogue[1] = tt; return 0; diff --git a/daemon/codec.c b/daemon/codec.c index 3841ccfbb..ca1a9542d 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -2936,6 +2936,27 @@ out: #endif +void codec_update_all_handlers(struct call_monologue *ml) { + for (GList *l = ml->subscribers.head; l; l = l->next) { + struct call_subscription *cs = l->data; + struct call_monologue *sink = cs->monologue; + + // iterate both simultaneously + GList *source_media_it = ml->medias.head; + GList *sink_media_it = sink->medias.head; + while (source_media_it && sink_media_it) { + struct call_media *source_media = source_media_it->data; + struct call_media *sink_media = sink_media_it->data; + codec_handlers_update(source_media, sink_media, NULL, NULL); + source_media_it = source_media_it->next; + sink_media_it = sink_media_it->next; + } + } + + dialogue_unkernelize(ml); +} + + void codec_calc_jitter(struct ssrc_ctx *ssrc, unsigned long ts, unsigned int clockrate, const struct timeval *tv) { diff --git a/include/call.h b/include/call.h index f79e7d09b..35c5592a4 100644 --- a/include/call.h +++ b/include/call.h @@ -633,6 +633,7 @@ void call_media_free(struct call_media **mdp); enum call_stream_state call_stream_state_machine(struct packet_stream *); void call_media_state_machine(struct call_media *m); void call_media_unkernelize(struct call_media *media); +void dialogue_unkernelize(struct call_monologue *ml); void __monologue_unkernelize(struct call_monologue *monologue); int call_stream_address46(char *o, struct packet_stream *ps, enum stream_address_format format, diff --git a/include/codec.h b/include/codec.h index 36f43b4cf..244ec6403 100644 --- a/include/codec.h +++ b/include/codec.h @@ -25,6 +25,7 @@ struct rtcp_timer; struct mqtt_timer; struct call; struct codec_store; +struct call_monologue; typedef int codec_handler_func(struct codec_handler *, struct media_packet *); @@ -85,6 +86,7 @@ void codec_handlers_free(struct call_media *); struct codec_handler *codec_handler_make_playback(const struct rtp_payload_type *src_pt, const struct rtp_payload_type *dst_pt, unsigned long ts, struct call_media *); void codec_calc_jitter(struct ssrc_ctx *, unsigned long ts, unsigned int clockrate, const struct timeval *); +void codec_update_all_handlers(struct call_monologue *ml); void codec_store_cleanup(struct codec_store *cs); void codec_store_init(struct codec_store *cs, struct call_media *);