| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-05-12 13:28:41 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2025-05-12 13:36:16 UTC |
| parent | 6e089c86b1013791639cad263c3c03ad1376cd0d |
| snikket/jingle/SessionDescription.hx | +4 | -2 |
diff --git a/snikket/jingle/SessionDescription.hx b/snikket/jingle/SessionDescription.hx index d9dd9a8..58cdc83 100644 --- a/snikket/jingle/SessionDescription.hx +++ b/snikket/jingle/SessionDescription.hx @@ -426,7 +426,7 @@ class Media { } } description.addChildren(fbs.filter((fb) -> fb.id == "*").map((fb) -> fb.el)); - description.addChildren(attributes.filter((attr) -> attr.key == "rtpmap").map((rtpmap) -> { + final rtpmaps = attributes.filter((attr) -> attr.key == "rtpmap").map((rtpmap) -> { final pos = rtpmap.value.indexOf(" "); if (pos < 0) throw "invalid rtpmap"; final id = rtpmap.value.substr(0, pos); @@ -438,7 +438,9 @@ class Media { return new Stanza("payload-type", attrs) .addChildren(fbs.filter((fb) -> fb.id == id).map((fb) -> fb.el)) .addChildren(fmtp.get(id) == null ? [] : fmtp.get(id)); - })); + }); + rtpmaps.sort((a, b) -> formats.indexOf(Std.parseInt(a.attr.get("id"))) - formats.indexOf(Std.parseInt(b.attr.get("id")))); + description.addChildren(rtpmaps); if (attributes.exists((attr) -> attr.key == "extmap-allow-mixed") || sessionAttributes.exists((attr) -> attr.key == "extmap-allow-mixed")) { description.tag("extmap-allow-mixed", { xmlns: "urn:xmpp:jingle:apps:rtp:rtp-hdrext:0" }).up(); }