Browse Source

TT#14008 allow ICE reset only during an offer

Change-Id: Ic2daaeba4d14867ffc96ab13f1d9493082ce0bd2
pull/1457/head
Richard Fuchs 4 years ago
parent
commit
e59c062108
4 changed files with 23 additions and 17 deletions
  1. +14
    -12
      daemon/call.c
  2. +7
    -3
      daemon/ice.c
  3. +1
    -1
      daemon/janus.c
  4. +1
    -1
      include/ice.h

+ 14
- 12
daemon/call.c View File

@ -2464,7 +2464,9 @@ void codecs_offer_answer(struct call_media *media, struct call_media *other_medi
/* called with call->master_lock held in W */
static void __update_init_subscribers(struct call_monologue *ml, GQueue *streams, struct sdp_ng_flags *flags) {
static void __update_init_subscribers(struct call_monologue *ml, GQueue *streams, struct sdp_ng_flags *flags,
enum call_opmode opmode)
{
GList *sl = streams ? streams->head : NULL;
// create media iterators for all subscribers
@ -2508,7 +2510,7 @@ static void __update_init_subscribers(struct call_monologue *ml, GQueue *streams
}
// we are now ready to fire up ICE if so desired and requested
ice_update(media->ice_agent, sp); // sp == NULL: update in case rtcp-mux changed
ice_update(media->ice_agent, sp, opmode == OP_OFFER); // sp == NULL: update in case rtcp-mux changed
recording_setup_media(media);
t38_gateway_start(media->t38_gateway);
@ -2581,7 +2583,7 @@ static int __media_init_from_flags(struct call_media *other_media, struct call_m
return ERROR_NO_ICE_AGENT;
if (!other_media->ice_agent)
return ERROR_NO_ICE_AGENT;
ice_update(other_media->ice_agent, sp);
ice_update(other_media->ice_agent, sp, false);
return 1; // done, continue
}
@ -2852,8 +2854,8 @@ int monologue_offer_answer(struct call_monologue *dialogue[2], GQueue *streams,
}
}
__update_init_subscribers(other_ml, streams, flags);
__update_init_subscribers(monologue, NULL, NULL);
__update_init_subscribers(other_ml, streams, flags, flags ? flags->opmode : OP_OFFER);
__update_init_subscribers(monologue, NULL, NULL, flags ? flags->opmode : OP_OFFER);
// set ipv4/ipv6/mixed media stats
if (flags && (flags->opmode == OP_OFFER || flags->opmode == OP_ANSWER)) {
@ -3022,7 +3024,7 @@ int monologue_publish(struct call_monologue *ml, GQueue *streams, struct sdp_ng_
if (__init_streams(media, NULL, sp, flags))
return -1;
__ice_start(media);
ice_update(media->ice_agent, sp);
ice_update(media->ice_agent, sp, false);
}
return 0;
@ -3088,8 +3090,8 @@ static int monologue_subscribe_request1(struct call_monologue *src_ml, struct ca
__add_subscription(dst_ml, src_ml, false, idx_diff);
__update_init_subscribers(src_ml, NULL, NULL);
__update_init_subscribers(dst_ml, NULL, NULL);
__update_init_subscribers(src_ml, NULL, NULL, flags->opmode);
__update_init_subscribers(dst_ml, NULL, NULL, flags->opmode);
return 0;
}
@ -3172,13 +3174,13 @@ int monologue_subscribe_answer(struct call_monologue *dst_ml, struct sdp_ng_flag
MEDIA_SET(dst_media, INITIALIZED);
}
__update_init_subscribers(dst_ml, streams, flags);
__update_init_subscribers(dst_ml, streams, flags, flags->opmode);
dialogue_unkernelize(dst_ml);
for (GList *l = dst_ml->subscriptions.head; l; l = l->next) {
struct call_subscription *cs = l->data;
struct call_monologue *src_ml = cs->monologue;
__update_init_subscribers(src_ml, NULL, NULL);
__update_init_subscribers(src_ml, NULL, NULL, flags->opmode);
dialogue_unkernelize(src_ml);
}
@ -3194,8 +3196,8 @@ int monologue_unsubscribe(struct call_monologue *dst_ml, struct sdp_ng_flags *fl
__unsubscribe_one_link(dst_ml, l);
__update_init_subscribers(dst_ml, NULL, NULL);
__update_init_subscribers(src_ml, NULL, NULL);
__update_init_subscribers(dst_ml, NULL, NULL, flags->opmode);
__update_init_subscribers(src_ml, NULL, NULL, flags->opmode);
dialogue_unkernelize(src_ml);
dialogue_unkernelize(dst_ml);


+ 7
- 3
daemon/ice.c View File

@ -314,7 +314,7 @@ void ice_restart(struct ice_agent *ag) {
}
/* called with the call lock held in W, hence agent doesn't need to be locked */
void ice_update(struct ice_agent *ag, struct stream_params *sp) {
void ice_update(struct ice_agent *ag, struct stream_params *sp, bool allow_reset) {
GList *l, *k;
struct ice_candidate *cand, *dup;
struct call_media *media;
@ -335,8 +335,12 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp) {
__role_change(ag, MEDIA_ISSET(media, ICE_CONTROLLING));
if (sp) {
if (ice_is_restart(ag, sp))
__ice_restart(ag);
if (ice_is_restart(ag, sp)) {
if (!allow_reset)
ilog(LOG_WARN, "ICE restart detected, but reset not allowed at this point");
else
__ice_restart(ag);
}
/* update remote info */
if (sp->ice_ufrag.s)


+ 1
- 1
daemon/janus.c View File

@ -1345,7 +1345,7 @@ const char *janus_trickle(JsonReader *reader, struct janus_session *session, uin
str_init(&sp.ice_ufrag, (char *) ufrag);
g_queue_push_tail(&sp.ice_candidates, &cand);
ice_update(media->ice_agent, &sp);
ice_update(media->ice_agent, &sp, false);
g_queue_clear(&sp.ice_candidates);
}


+ 1
- 1
include/ice.h View File

@ -153,7 +153,7 @@ bool ice_has_related(enum ice_candidate_type);
void ice_foundation(str *);
void ice_agent_init(struct ice_agent **agp, struct call_media *media);
void ice_update(struct ice_agent *, struct stream_params *);
void ice_update(struct ice_agent *, struct stream_params *, bool allow_restart);
void ice_shutdown(struct ice_agent **);
void ice_restart(struct ice_agent *);


Loading…
Cancel
Save