MT#55283 reverse handling of media attributes

Consider call_media SDP attributes as ones that were received instead of
the ones to be sent out. Use media subscriptions to look up the source
media and print that one's attributes when creating an outgoing SDP.

Change-Id: Ibdf3a77a6f8a61654e0fc7c14aae16dfc6eabf14
pull/1786/head
Richard Fuchs 2 years ago
parent 24fb7a0bd7
commit 1454500979

@ -2701,13 +2701,13 @@ static void __media_init_from_flags(struct call_media *other_media, struct call_
}
}
/* moved as plain text attributes, required later by sdp_create()
* extmap
* other (unknown type)
*/
if (media) {
t_queue_clear_full(&media->sdp_attributes, sdp_attr_free);
media->sdp_attributes = *additional_attributes;
if (flags->opmode == OP_OFFER || flags->opmode == OP_ANSWER || flags->opmode == OP_PUBLISH) {
/* moved as plain text attributes, required later by sdp_create()
* extmap
* other (unknown type)
*/
t_queue_clear_full(&other_media->sdp_attributes, sdp_attr_free);
other_media->sdp_attributes = *additional_attributes;
t_queue_init(additional_attributes);
}

@ -2149,7 +2149,16 @@ static void insert_codec_parameters(GString *s, struct call_media *cm,
}
void sdp_insert_media_attributes(GString *gs, union sdp_attr_print_arg a, const sdp_ng_flags *flags) {
for (__auto_type l = a.cm->sdp_attributes.head; l; l = l->next) {
// Look up the source media. We copy the source's attributes if there is only one source
// media. Otherwise we skip this step.
if (a.cm->media_subscriptions.length != 1)
return;
__auto_type sub = a.cm->media_subscriptions.head->data;
__auto_type sub_m = sub->media;
for (__auto_type l = sub_m->sdp_attributes.head; l; l = l->next) {
__auto_type s = l->data;
if (s->type == SDP_ATTR_TYPE_EXTMAP && flags->strip_extmap && !MEDIA_ISSET(a.cm, PASSTHRU))
continue;

@ -117,6 +117,9 @@ m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=label:1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP
@ -153,6 +156,9 @@ m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=label:1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP
@ -189,6 +195,9 @@ m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=label:1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP
@ -226,6 +235,9 @@ m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=label:1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=inactive
a=rtcp:PORT
SDP
@ -262,6 +274,9 @@ m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=label:1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP
@ -1158,12 +1173,18 @@ m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
m=audio PORT RTP/AVP 0 8
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=b-dummy
a=b-foo:bar
a=b-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP
@ -3299,6 +3320,9 @@ a=s-baz:quux blah
m=audio PORT RTP/AVP 0
c=IN IP4 203.0.113.1
a=rtpmap:0 PCMU/8000
a=m-dummy
a=m-foo:bar
a=m-baz:quux blah
a=sendonly
a=rtcp:PORT
SDP

@ -1574,6 +1574,7 @@ a=rtpmap:118 AMR/8000
a=fmtp:118 mode-set=0,2,4,7;mode-change-period=2;mode-change-capability=2;mode-change-neighbor=1;max-red=0
a=rtpmap:98 telephone-event/8000
a=fmtp:98 0-15
a=msi:mavodi-0-15b-6c6-2-ffffffff-d3c00000-6005c95738e64-171f-ffffffffffffffff-@127.0.0.1-127.0.0.1;UAG-ELL-45-108
a=sendonly
a=rtcp:PORT
a=ptime:20

Loading…
Cancel
Save