parse extmap-allow-mixed
This commit is contained in:
parent
3baacf8862
commit
6f1b71970d
|
@ -40,7 +40,7 @@ public class RtpContentMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RtpContentMap of(final JinglePacket jinglePacket) {
|
public static RtpContentMap of(final JinglePacket jinglePacket) {
|
||||||
final Map<String, DescriptionTransport> contents = DescriptionTransport.of(jinglePacket.getJingleContents());
|
final Map<String, DescriptionTransport> contents = DescriptionTransport.of(jinglePacket.getJingleContents());
|
||||||
if (isOmemoVerified(contents)) {
|
if (isOmemoVerified(contents)) {
|
||||||
return new OmemoVerifiedRtpContentMap(jinglePacket.getGroup(), contents);
|
return new OmemoVerifiedRtpContentMap(jinglePacket.getGroup(), contents);
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,7 +53,7 @@ public class RtpContentMap {
|
||||||
if (values.size() == 0) {
|
if (values.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for(final DescriptionTransport descriptionTransport : values) {
|
for (final DescriptionTransport descriptionTransport : values) {
|
||||||
if (descriptionTransport.transport instanceof OmemoVerifiedIceUdpTransportInfo) {
|
if (descriptionTransport.transport instanceof OmemoVerifiedIceUdpTransportInfo) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ public class RtpContentMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DescriptionTransport of(final SessionDescription sessionDescription, final SessionDescription.Media media) {
|
public static DescriptionTransport of(final SessionDescription sessionDescription, final SessionDescription.Media media) {
|
||||||
final RtpDescription rtpDescription = RtpDescription.of(media);
|
final RtpDescription rtpDescription = RtpDescription.of(sessionDescription, media);
|
||||||
final IceUdpTransportInfo transportInfo = IceUdpTransportInfo.of(sessionDescription, media);
|
final IceUdpTransportInfo transportInfo = IceUdpTransportInfo.of(sessionDescription, media);
|
||||||
return new DescriptionTransport(rtpDescription, transportInfo);
|
return new DescriptionTransport(rtpDescription, transportInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,10 +198,10 @@ public class SessionDescription {
|
||||||
checkNoWhitespace(type, "feedback negotiation type must not contain whitespace");
|
checkNoWhitespace(type, "feedback negotiation type must not contain whitespace");
|
||||||
mediaAttributes.put("rtcp-fb", "* " + type + (Strings.isNullOrEmpty(subtype) ? "" : " " + subtype));
|
mediaAttributes.put("rtcp-fb", "* " + type + (Strings.isNullOrEmpty(subtype) ? "" : " " + subtype));
|
||||||
}
|
}
|
||||||
for (RtpDescription.FeedbackNegotiationTrrInt feedbackNegotiationTrrInt : description.feedbackNegotiationTrrInts()) {
|
for (final RtpDescription.FeedbackNegotiationTrrInt feedbackNegotiationTrrInt : description.feedbackNegotiationTrrInts()) {
|
||||||
mediaAttributes.put("rtcp-fb", "* trr-int " + feedbackNegotiationTrrInt.getValue());
|
mediaAttributes.put("rtcp-fb", "* trr-int " + feedbackNegotiationTrrInt.getValue());
|
||||||
}
|
}
|
||||||
for (RtpDescription.RtpHeaderExtension extension : description.getHeaderExtensions()) {
|
for (final RtpDescription.RtpHeaderExtension extension : description.getHeaderExtensions()) {
|
||||||
final String id = extension.getId();
|
final String id = extension.getId();
|
||||||
final String uri = extension.getUri();
|
final String uri = extension.getUri();
|
||||||
if (Strings.isNullOrEmpty(id)) {
|
if (Strings.isNullOrEmpty(id)) {
|
||||||
|
@ -214,7 +214,12 @@ public class SessionDescription {
|
||||||
checkNoWhitespace(uri, "feedback negotiation uri must not contain whitespace");
|
checkNoWhitespace(uri, "feedback negotiation uri must not contain whitespace");
|
||||||
mediaAttributes.put("extmap", id + " " + uri);
|
mediaAttributes.put("extmap", id + " " + uri);
|
||||||
}
|
}
|
||||||
for (RtpDescription.SourceGroup sourceGroup : description.getSourceGroups()) {
|
|
||||||
|
if (description.hasChild("extmap-allow-mixed", Namespace.JINGLE_RTP_HEADER_EXTENSIONS)) {
|
||||||
|
mediaAttributes.put("extmap-allow-mixed", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final RtpDescription.SourceGroup sourceGroup : description.getSourceGroups()) {
|
||||||
final String semantics = sourceGroup.getSemantics();
|
final String semantics = sourceGroup.getSemantics();
|
||||||
final List<String> groups = sourceGroup.getSsrcs();
|
final List<String> groups = sourceGroup.getSsrcs();
|
||||||
if (Strings.isNullOrEmpty(semantics)) {
|
if (Strings.isNullOrEmpty(semantics)) {
|
||||||
|
@ -226,8 +231,8 @@ public class SessionDescription {
|
||||||
}
|
}
|
||||||
mediaAttributes.put("ssrc-group", String.format("%s %s", semantics, Joiner.on(' ').join(groups)));
|
mediaAttributes.put("ssrc-group", String.format("%s %s", semantics, Joiner.on(' ').join(groups)));
|
||||||
}
|
}
|
||||||
for (RtpDescription.Source source : description.getSources()) {
|
for (final RtpDescription.Source source : description.getSources()) {
|
||||||
for (RtpDescription.Source.Parameter parameter : source.getParameters()) {
|
for (final RtpDescription.Source.Parameter parameter : source.getParameters()) {
|
||||||
final String id = source.getSsrcId();
|
final String id = source.getSsrcId();
|
||||||
final String parameterName = parameter.getParameterName();
|
final String parameterName = parameter.getParameterName();
|
||||||
final String parameterValue = parameter.getParameterValue();
|
final String parameterValue = parameter.getParameterValue();
|
||||||
|
|
|
@ -6,11 +6,14 @@ import com.google.common.base.Preconditions;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import eu.siacs.conversations.xml.Element;
|
import eu.siacs.conversations.xml.Element;
|
||||||
import eu.siacs.conversations.xml.Namespace;
|
import eu.siacs.conversations.xml.Namespace;
|
||||||
|
@ -530,11 +533,15 @@ public class RtpDescription extends GenericDescription {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RtpDescription of(final SessionDescription.Media media) {
|
public static RtpDescription of(final SessionDescription sessionDescription, final SessionDescription.Media media) {
|
||||||
final RtpDescription rtpDescription = new RtpDescription(media.media);
|
final RtpDescription rtpDescription = new RtpDescription(media.media);
|
||||||
final Map<String, List<Parameter>> parameterMap = new HashMap<>();
|
final Map<String, List<Parameter>> parameterMap = new HashMap<>();
|
||||||
final ArrayListMultimap<String, Element> feedbackNegotiationMap = ArrayListMultimap.create();
|
final ArrayListMultimap<String, Element> feedbackNegotiationMap = ArrayListMultimap.create();
|
||||||
final ArrayListMultimap<String, Source.Parameter> sourceParameterMap = ArrayListMultimap.create();
|
final ArrayListMultimap<String, Source.Parameter> sourceParameterMap = ArrayListMultimap.create();
|
||||||
|
final Set<String> attributes = Sets.newHashSet(Iterables.concat(
|
||||||
|
sessionDescription.attributes.keySet(),
|
||||||
|
media.attributes.keySet()
|
||||||
|
));
|
||||||
for (final String rtcpFb : media.attributes.get("rtcp-fb")) {
|
for (final String rtcpFb : media.attributes.get("rtcp-fb")) {
|
||||||
final String[] parts = rtcpFb.split(" ");
|
final String[] parts = rtcpFb.split(" ");
|
||||||
if (parts.length >= 2) {
|
if (parts.length >= 2) {
|
||||||
|
@ -581,6 +588,9 @@ public class RtpDescription extends GenericDescription {
|
||||||
rtpDescription.addChild(extension);
|
rtpDescription.addChild(extension);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (attributes.contains("extmap-allow-mixed")) {
|
||||||
|
rtpDescription.addChild("extmap-allow-mixed", Namespace.JINGLE_RTP_HEADER_EXTENSIONS);
|
||||||
|
}
|
||||||
for (final String ssrcGroup : media.attributes.get("ssrc-group")) {
|
for (final String ssrcGroup : media.attributes.get("ssrc-group")) {
|
||||||
final String[] parts = ssrcGroup.split(" ");
|
final String[] parts = ssrcGroup.split(" ");
|
||||||
if (parts.length >= 2) {
|
if (parts.length >= 2) {
|
||||||
|
|
Loading…
Reference in a new issue