Browse Source

TT#45472 process and retain media ID strings (a=mid)

Change-Id: Icf7219f407ed660c009ffde838c942e13aad40ce
changes/31/25331/4
Richard Fuchs 7 years ago
parent
commit
3c50130c7b
3 changed files with 33 additions and 10 deletions
  1. +18
    -0
      daemon/call.c
  2. +13
    -10
      daemon/sdp.c
  3. +2
    -0
      include/call.h

+ 18
- 0
daemon/call.c View File

@ -1669,6 +1669,23 @@ static void __endpoint_loop_protect(struct stream_params *sp, struct call_media
MEDIA_SET(media, LOOP_CHECK);
}
static void __update_media_id(struct call_media *media, struct call_media *other_media,
struct stream_params *sp, const struct sdp_ng_flags *flags)
{
struct call *call = media->call;
if (!other_media->media_id.s) {
// incoming side: we copy what we received
if (sp->media_id.s)
call_str_cpy(call, &other_media->media_id, &sp->media_id);
}
if (!media->media_id.s) {
// outgoing side: we copy from the other side
if (other_media->media_id.s)
call_str_cpy(call, &media->media_id, &other_media->media_id);
}
}
/* called with call->master_lock held in W */
int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams,
const struct sdp_ng_flags *flags)
@ -1741,6 +1758,7 @@ int monologue_offer_answer(struct call_monologue *other_ml, GQueue *streams,
&& other_media->protocol && other_media->protocol->rtp)
media->protocol = flags->transport_protocol;
__update_media_id(media, other_media, sp, flags);
__endpoint_loop_protect(sp, other_media);
if (sp->rtp_endpoint.port) {


+ 13
- 10
daemon/sdp.c View File

@ -169,7 +169,7 @@ struct attribute_fmtp {
unsigned int payload_type;
};
struct sdp_attribute {
struct sdp_attribute { /* example: a=rtpmap:8 PCMA/8000 */
str full_line, /* including a= and \r\n */
line_value, /* without a= and without \r\n */
name, /* just "rtpmap" */
@ -1323,6 +1323,11 @@ int sdp_streams(const GQueue *sessions, GQueue *streams, struct sdp_ng_flags *fl
sp->fingerprint.hash_func->num_bytes);
}
// a=mid
attr = attr_get_by_id(&media->attributes, ATTR_MID);
if (attr)
sp->media_id = attr->value;
__sdp_ice(sp, media);
/* determine RTCP endpoint */
@ -1697,6 +1702,7 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media *
case ATTR_SENDRECV:
case ATTR_IGNORE:
case ATTR_END_OF_CANDIDATES: // we strip it here and re-insert it later
case ATTR_MID:
goto strip;
case ATTR_RTPMAP:
@ -1714,15 +1720,6 @@ static int process_media_attributes(struct sdp_chopper *chop, struct sdp_media *
break;
goto strip;
case ATTR_MID:
if (MEDIA_ISSET(media, PASSTHRU))
break;
// a = attr_get_by_id(&sdp->session->attributes, ATTR_GROUP);
// if (a && a->u.group.semantics == GROUP_BUNDLE)
// goto strip;
goto strip; // hack/workaround: always remove a=mid
break;
default:
break;
}
@ -2063,6 +2060,12 @@ int sdp_replace(struct sdp_chopper *chop, GQueue *sessions, struct call_monologu
copy_up_to_end_of(chop, &sdp_media->s);
if (call_media->media_id.s) {
chopper_append_c(chop, "a=mid:");
chopper_append_str(chop, &call_media->media_id);
chopper_append_c(chop, "\r\n");
}
insert_codec_parameters(chop, call_media);
ps_rtcp = NULL;


+ 2
- 0
include/call.h View File

@ -242,6 +242,7 @@ struct stream_params {
str ice_ufrag;
str ice_pwd;
int ptime;
str media_id;
};
struct endpoint_map {
@ -320,6 +321,7 @@ struct call_media {
struct ice_agent *ice_agent;
str media_id;
GQueue sdes_in, sdes_out;
struct dtls_fingerprint fingerprint; /* as received */


Loading…
Cancel
Save