MT#55283 parse a=label

This is needed to correctly print media labels for SIPREC in case the
input SDPs already had media labels.

Change-Id: I021f44ba28a3648ceb62db12425ddf545de42a96
(cherry picked from commit 9a65ab0335)
mr14.1
Richard Fuchs 2 months ago
parent 6ef9aab8df
commit 42270ad772

@ -2862,6 +2862,15 @@ static void media_set_siprec_label(struct call_media *media, sdp_ng_flags *flags
media->label = call_str_cpy_c(buf);
}
__attribute__((nonnull(1, 2)))
static void media_update_label(struct call_media *media, sdp_ng_flags *flags, const str *label)
{
if (flags->siprec) // we generate our own
return;
media->label = call_str_cpy(label);
}
__attribute__((nonnull(1)))
static unsigned int media_bundle_extmap_id(struct call_media *media) {
__auto_type ml = media->monologue;
@ -3874,6 +3883,7 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *
}
else
media_answer_media_id(sender_media, sp);
media_update_label(receiver_media, flags, &sp->label);
media_loop_protect(sp, sender_media);
media_update_flags(sender_media, sp);
media_update_crypto(sender_media, sp, flags);
@ -4433,6 +4443,7 @@ static int monologue_subscribe_request1(struct call_monologue *src_ml, struct ca
media_set_echo(src_media, flags);
media_set_echo_reverse(dst_media, flags);
media_set_siprec_label(dst_media, flags, src_media->unique_id);
media_update_label(dst_media, flags, &src_media->label);
media_update_type(dst_media, sp);
media_set_protocol(dst_media, src_media, sp, flags);
media_gen_media_id(dst_media, flags);

@ -68,6 +68,7 @@ enum attr_id {
ATTR_MOH_ATTR_NAME,
ATTR_EXTMAP,
ATTR_EXTMAP_ALLOW_MIXED,
ATTR_LABEL,
};
// make sure g_direct_hash can be used
static_assert(sizeof(void *) >= sizeof(enum attr_id), "sizeof enum attr_id wrong");
@ -1331,6 +1332,9 @@ static bool parse_attribute(struct sdp_attribute *a) {
case CSH_LOOKUP("maxptime"):
a->attr = ATTR_MAXPTIME;
break;
case CSH_LOOKUP("label"):
a->attr = ATTR_LABEL;
break;
default:
/* check moh-attr-name (can be a variable attribute value) */
if (rtpe_config.moh_attr_name && !str_cmp(&a->strs.name, rtpe_config.moh_attr_name))
@ -2155,6 +2159,11 @@ bool sdp_streams(const sdp_sessions_q *sessions, sdp_streams_q *streams, sdp_ng_
if (attr)
sp->media_id = attr->strs.value;
// a=label
attr = attr_get_by_id(&media->attributes, ATTR_LABEL);
if (attr)
sp->label = attr->strs.value;
// be ignorant about the contents
if (attr_get_by_id(&media->attributes, ATTR_RTCP_FB))
SP_SET(sp, RTCP_FB);
@ -2908,7 +2917,7 @@ static void print_sdp_media_section(GString *s, struct call_media *media,
/* mid and label must be added even for inactive streams (see #1361 and #1362). */
if (media->media_id.s)
append_attr_to_gstring(s, "mid", &media->media_id, flags, media->type_id);
if (media->label.len && flags->siprec)
if (media->label.len)
append_attr_to_gstring(s, "label", &media->label, flags, media->type_id);
if (media->bundle && MEDIA_ISSET(media, BUNDLE_ONLY) && flags->opmode == OP_OFFER
&& media->bundle != media)

@ -385,6 +385,7 @@ struct stream_params {
struct session_bandwidth media_session_bandiwdth;
str sdp_information;
extmap_q extmap;
str label;
};
struct endpoint_map {

@ -4456,6 +4456,7 @@ m=video PORT RTP/AVP 99 97 126 123
c=IN IP6 2001:db8:4321::1
b=TIAS:5952000
a=mid:2
a=label:11
a=rtpmap:99 H265/90000
a=fmtp:99 level-id=90;max-lsr=125337600;max-lps=2088960;max-tr=22;max-tc=20;max-fps=6000;x-cisco-hevc=529
a=rtpmap:97 H264/90000
@ -4470,7 +4471,6 @@ a=rtcp-fb:* ccm pan
a=rtcp-fb:* nack pli
a=rtcp-fb:* ccm fir
a=rtcp-fb:* ccm tmmbr
a=label:11
a=answer:full
a=cisco-mari-psre:97 ltrf=3
a=cisco-mari-psre:126 ltrf=3
@ -4927,6 +4927,7 @@ m=video 0 RTP/AVP 99 97 126 123
c=IN IP6 ::
b=TIAS:5952000
a=mid:2
a=label:11
m=application 0 RTP/SAVP 96
c=IN IP4 0.0.0.0
a=mid:5
@ -24876,6 +24877,7 @@ t=0 0
m=audio PORT RTP/AVP 104 9 103 111 8 101
c=IN IP4 203.0.113.1
a=mid:1
a=label:main-audio
a=rtpmap:104 SILK/16000
a=rtpmap:9 G722/8000
a=rtpmap:103 SILK/8000
@ -24884,7 +24886,6 @@ a=fmtp:111 bitrate=16000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=label:main-audio
a=sendrecv
a=rtcp:PORT
a=ptime:20

Loading…
Cancel
Save