From 33ef09b470fe6b570d368073988d48fd1741d1dd Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Fri, 22 Feb 2013 12:29:28 -0500 Subject: [PATCH] insert ice candidate for rtcp --- daemon/sdp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/daemon/sdp.c b/daemon/sdp.c index 232cfa673..fa46debd6 100644 --- a/daemon/sdp.c +++ b/daemon/sdp.c @@ -513,7 +513,7 @@ warn: return 0; } -static int insert_ice_address(struct sdp_chopper *chop, GList *m, int off, struct sdp_ng_flags *flags) { +static int insert_ice_address(struct sdp_chopper *chop, GList *m, int off, struct sdp_ng_flags *flags, int streamoff) { struct callstream *cs; struct peer *peer; struct streamrelay *sr; @@ -522,7 +522,7 @@ static int insert_ice_address(struct sdp_chopper *chop, GList *m, int off, struc cs = m->data; peer = &cs->peers[off]; - sr = &peer->rtps[0]; + sr = &peer->rtps[streamoff]; if (!flags->trust_address && flags->received_from_family.len == 3 && flags->received_from_address.len) chopper_append_str(chop, &flags->received_from_address); @@ -714,9 +714,12 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call, if (flags->ice_force) { copy_up_to_end_of(chop, &media->s); - /* XXX insert proper priority */ - chopper_append_c(chop, "a=candidate:1 1 UDP 1 "); - insert_ice_address(chop, m, off, flags); + /* prio = (2^24) * 126 + (2^8) * 65535 + (256 - componentID) */ + chopper_append_c(chop, "a=candidate:1 1 UDP 2130706431 "); + insert_ice_address(chop, m, off, flags, 0); + chopper_append_c(chop, " typ host\r\n"); + chopper_append_c(chop, "a=candidate:1 2 UDP 2130706430 "); + insert_ice_address(chop, m, off, flags, 1); chopper_append_c(chop, " typ host\r\n"); } }