support removal of ICE attributes

git.mgm/mediaproxy-ng/2.2
Richard Fuchs 13 years ago
parent 4914d6babb
commit 30669f2cd3

@ -2183,6 +2183,7 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, GQueue *streams, ben
int diridx;
enum stream_direction dirs[2];
GList *gl;
str s;
ZERO(*out);
ZERO(dirs);
@ -2228,6 +2229,11 @@ static void call_ng_process_flags(struct sdp_ng_flags *out, GQueue *streams, ben
bencode_get_str(it, &out->received_from_address);
bencode_get_str(it->sibling, &out->received_from_family);
}
if (bencode_dictionary_get_str(input, "ICE", &s)) {
if (!str_cmp(&s, "remove"))
out->ice_remove = 1;
}
}
static unsigned int stream_hash(struct stream_input *s) {

@ -529,6 +529,54 @@ void sdp_chopper_destroy(struct sdp_chopper *chop) {
g_slice_free1(sizeof(*chop), chop);
}
static int remove_ice(struct sdp_chopper *chop, GQueue *attrs) {
struct sdp_attribute *attr;
GList *l;
for (l = attrs->head; l; l = l->next) {
attr = l->data;
switch (attr->attribute_name.len) {
case 7:
if (!str_cmp(&attr->attribute_name, "ice-pwd"))
goto strip;
break;
case 8:
if (!str_cmp(&attr->attribute_name, "ice-lite"))
goto strip;
break;
case 9:
if (!str_cmp(&attr->attribute_name, "candidate"))
goto strip;
if (!str_cmp(&attr->attribute_name, "ice-ufrag"))
goto strip;
break;
case 11:
if (!str_cmp(&attr->attribute_name, "ice-options"))
goto strip;
break;
case 12:
if (!str_cmp(&attr->attribute_name, "ice-mismatch"))
goto strip;
break;
case 17:
if (!str_cmp(&attr->attribute_name, "remote-candidates"))
goto strip;
break;
}
continue;
strip:
if (copy_up_to(chop, &attr->full_line))
return -1;
if (skip_over(chop, &attr->full_line))
return -1;
}
return 0;
}
int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call,
enum call_opmode opmode, struct sdp_ng_flags *flags, GHashTable *streamhash)
{
@ -553,6 +601,11 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call,
goto error;
}
if (flags->ice_remove) {
if (remove_ice(chop, &session->attributes))
goto error;
}
for (k = session->media_streams.head; k; k = k->next) {
media = k->data;
@ -576,6 +629,12 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call *call,
if (replace_network_address(chop, &media->connection.address, m, off, flags))
goto error;
}
if (flags->ice_remove) {
if (remove_ice(chop, &media->attributes))
goto error;
}
}
}

@ -14,7 +14,8 @@ struct sdp_ng_flags {
symmetric:1,
trust_address:1,
replace_origin:1,
replace_sess_conn:1;
replace_sess_conn:1,
ice_remove:1;
};
struct sdp_chopper {

Loading…
Cancel
Save