From f995965deace048ec071a11708371c7ce859895b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 15 Apr 2020 20:19:09 +0200 Subject: [PATCH] parse 0339 source groups from sdp --- .../xmpp/jingle/stanzas/RtpDescription.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java index 70f3f0f6a..d40363b49 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java @@ -9,7 +9,6 @@ import com.google.common.collect.ImmutableList; import java.util.Collection; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import eu.siacs.conversations.xml.Element; @@ -479,6 +478,14 @@ public class RtpDescription extends GenericDescription { public static class SourceGroup extends Element { + public SourceGroup(final String semantics, List ssrcs) { + this(); + this.setAttribute("semantics", semantics); + for (String ssrc : ssrcs) { + this.addChild("source").setAttribute("ssrc", ssrc); + } + } + private SourceGroup() { super("ssrc-group", Namespace.JINGLE_RTP_SOURCE_SPECIFIC_MEDIA_ATTRIBUTES); } @@ -561,6 +568,17 @@ public class RtpDescription extends GenericDescription { rtpDescription.addChild(extension); } } + for (final String ssrcGroup : media.attributes.get("ssrc-group")) { + final String[] parts = ssrcGroup.split(" "); + if (parts.length >= 2) { + ImmutableList.Builder builder = new ImmutableList.Builder<>(); + final String semantics = parts[0]; + for (int i = 1; i < parts.length; ++i) { + builder.add(parts[i]); + } + rtpDescription.addChild(new SourceGroup(semantics, builder.build())); + } + } for (Map.Entry> source : sourceParameterMap.asMap().entrySet()) { rtpDescription.addChild(new Source(source.getKey(), source.getValue())); }