apply ice-options when adding content or restarting ice
This commit is contained in:
parent
a98738ae9d
commit
6bc3cad7de
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -89,7 +96,8 @@ 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())) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue