ignore endpoint changes when ICE is in use

pull/148/head
Richard Fuchs 10 years ago
parent 87feafc790
commit 59b0f331ad

@ -1892,8 +1892,11 @@ static int __num_media_streams(struct call_media *media, unsigned int num_ports)
return ret;
}
static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp, unsigned int port_off) {
static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp, unsigned int port_off,
const struct stream_params *sp)
{
struct endpoint ep;
struct call_media *media = ps->media;
ep = *epp;
ep.port += port_off;
@ -1902,9 +1905,15 @@ static void __fill_stream(struct packet_stream *ps, const struct endpoint *epp,
if (PS_ISSET(ps, FILLED) && !memcmp(&ps->advertised_endpoint, &ep, sizeof(ep)))
return;
ps->endpoint = ep;
ps->advertised_endpoint = ep;
/* ignore endpoint changes if we're ICE-enabled and ICE data hasn't changed */
if (PS_ISSET(ps, FILLED) && MEDIA_ISSET(media, ICE) && media->ice_agent && sp
&& !ice_ufrag_cmp(media->ice_agent, &sp->ice_ufrag))
return;
ps->endpoint = ep;
if (PS_ISSET(ps, FILLED)) {
/* we reset crypto params whenever the endpoint changes */
crypto_reset(&ps->crypto);
@ -2020,7 +2029,7 @@ static int __init_streams(struct call_media *A, struct call_media *B, const stru
__rtp_stats_update(a->rtp_stats, A->rtp_payload_types);
if (sp) {
__fill_stream(a, &sp->rtp_endpoint, port_off);
__fill_stream(a, &sp->rtp_endpoint, port_off, sp);
bf_copy_same(&a->ps_flags, &sp->sp_flags,
SHARED_FLAG_STRICT_SOURCE | SHARED_FLAG_MEDIA_HANDOVER);
}
@ -2065,11 +2074,11 @@ static int __init_streams(struct call_media *A, struct call_media *B, const stru
if (sp) {
if (!SP_ISSET(sp, IMPLICIT_RTCP)) {
__fill_stream(a, &sp->rtcp_endpoint, port_off);
__fill_stream(a, &sp->rtcp_endpoint, port_off, sp);
PS_CLEAR(a, IMPLICIT_RTCP);
}
else {
__fill_stream(a, &sp->rtp_endpoint, port_off + 1);
__fill_stream(a, &sp->rtp_endpoint, port_off + 1, sp);
PS_SET(a, IMPLICIT_RTCP);
}
bf_copy_same(&a->ps_flags, &sp->sp_flags,

@ -203,6 +203,9 @@ INLINE const char *ice_candidate_type_str(enum ice_candidate_type type) {
return 0;
return ice_type_strings[type];
}
INLINE int ice_ufrag_cmp(struct ice_agent *ag, const str *s) {
return str_cmp_str0(&ag->ufrag[0], s);
}

Loading…
Cancel
Save