M src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java => src/main/java/eu/siacs/conversations/xmpp/jingle/RtpContentMap.java +8 -5
@@ 210,6 210,12 @@ public class RtpContentMap {
throw new IllegalStateException("Content map does not have distinct credentials");
}
+ private Set<String> getCombinedIceOptions() {
+ final Collection<List<String>> combinedIceOptions =
+ Collections2.transform(contents.values(), dt -> dt.transport.getIceOptions());
+ return ImmutableSet.copyOf(Iterables.concat(combinedIceOptions));
+ }
+
public Set<IceUdpTransportInfo.Credentials> getCredentials() {
final Set<IceUdpTransportInfo.Credentials> credentials =
ImmutableSet.copyOf(
@@ 339,14 345,11 @@ public class RtpContentMap {
public RtpContentMap addContent(
final RtpContentMap modification, final IceUdpTransportInfo.Setup setup) {
final IceUdpTransportInfo.Credentials credentials = getDistinctCredentials();
+ final Collection<String> iceOptions = getCombinedIceOptions();
final DTLS dtls = getDistinctDtls();
final IceUdpTransportInfo iceUdpTransportInfo =
- IceUdpTransportInfo.of(credentials, setup, dtls.hash, dtls.fingerprint);
+ IceUdpTransportInfo.of(credentials, iceOptions, setup, dtls.hash, dtls.fingerprint);
final Map<String, DescriptionTransport> combined = merge(contents, modification.contents);
- /*new ImmutableMap.Builder<String, DescriptionTransport>()
- .putAll(contents)
- .putAll(modification.contents)
- .build();*/
final Map<String, DescriptionTransport> combinedFixedTransport =
Maps.transformValues(
combined,
M src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java => src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/IceUdpTransportInfo.java +19 -8
@@ 15,6 15,11 @@ import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
+import eu.siacs.conversations.Config;
+import eu.siacs.conversations.xml.Element;
+import eu.siacs.conversations.xml.Namespace;
+import eu.siacs.conversations.xmpp.jingle.SessionDescription;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ 26,11 31,6 @@ import java.util.Locale;
import java.util.Map;
import java.util.UUID;
-import eu.siacs.conversations.Config;
-import eu.siacs.conversations.xml.Element;
-import eu.siacs.conversations.xml.Namespace;
-import eu.siacs.conversations.xmpp.jingle.SessionDescription;
-
public class IceUdpTransportInfo extends GenericTransportInfo {
public static final IceUdpTransportInfo STUB = new IceUdpTransportInfo();
@@ 73,11 73,18 @@ public class IceUdpTransportInfo extends GenericTransportInfo {
}
public static IceUdpTransportInfo of(
- final Credentials credentials, final Setup setup, final String hash, final String fingerprint) {
+ final Credentials credentials,
+ final Collection<String> iceOptions,
+ final Setup setup,
+ final String hash,
+ final String fingerprint) {
final IceUdpTransportInfo iceUdpTransportInfo = new IceUdpTransportInfo();
iceUdpTransportInfo.addChild(Fingerprint.of(setup, hash, fingerprint));
iceUdpTransportInfo.setAttribute("ufrag", credentials.ufrag);
iceUdpTransportInfo.setAttribute("pwd", credentials.password);
+ for(final String iceOption : iceOptions) {
+ iceUdpTransportInfo.addChild(new IceOption(iceOption));
+ }
return iceUdpTransportInfo;
}
@@ 88,8 95,9 @@ public class IceUdpTransportInfo extends GenericTransportInfo {
public List<String> getIceOptions() {
final ImmutableList.Builder<String> optionBuilder = new ImmutableList.Builder<>();
- for(final Element child : this.children) {
- if (Namespace.JINGLE_TRANSPORT_ICE_OPTION.equals(child.getNamespace()) && IceOption.WELL_KNOWN.contains(child.getName())) {
+ for (final Element child : getChildren()) {
+ if (Namespace.JINGLE_TRANSPORT_ICE_OPTION.equals(child.getNamespace())
+ && IceOption.WELL_KNOWN.contains(child.getName())) {
optionBuilder.add(child.getName());
}
}
@@ 132,6 140,9 @@ public class IceUdpTransportInfo extends GenericTransportInfo {
transportInfo.addChild(fingerprint);
}
}
+ for (final String iceOption : this.getIceOptions()) {
+ transportInfo.addChild(new IceOption(iceOption));
+ }
return transportInfo;
}