a couple of bug fixes for SessionDescription.toString()

This commit is contained in:
Daniel Gultsch 2020-04-05 17:31:48 +02:00
parent f264ef9f8b
commit 885ec0febe
2 changed files with 15 additions and 22 deletions

View File

@ -92,20 +92,6 @@ public class JingleRtpConnection extends AbstractJingleConnection {
} }
private void processContents(final RtpContentMap contentMap) { private void processContents(final RtpContentMap contentMap) {
for (Map.Entry<String, RtpContentMap.DescriptionTransport> content : contentMap.contents.entrySet()) {
final RtpContentMap.DescriptionTransport descriptionTransport = content.getValue();
final RtpDescription rtpDescription = descriptionTransport.description;
Log.d(Config.LOGTAG, "receive content with name " + content.getKey() + " and media=" + rtpDescription.getMedia());
for (RtpDescription.PayloadType payloadType : rtpDescription.getPayloadTypes()) {
Log.d(Config.LOGTAG, "payload type: " + payloadType.toString());
}
for (RtpDescription.RtpHeaderExtension extension : rtpDescription.getHeaderExtensions()) {
Log.d(Config.LOGTAG, "extension: " + extension.toString());
}
final IceUdpTransportInfo iceUdpTransportInfo = descriptionTransport.transport;
Log.d(Config.LOGTAG, "transport: " + descriptionTransport.transport);
Log.d(Config.LOGTAG, "fingerprint " + iceUdpTransportInfo.getFingerprint());
}
setupWebRTC(); setupWebRTC();
org.webrtc.SessionDescription sessionDescription = new org.webrtc.SessionDescription(org.webrtc.SessionDescription.Type.OFFER, SessionDescription.of(contentMap).toString()); org.webrtc.SessionDescription sessionDescription = new org.webrtc.SessionDescription(org.webrtc.SessionDescription.Type.OFFER, SessionDescription.of(contentMap).toString());
Log.d(Config.LOGTAG, "debug print for sessionDescription:" + sessionDescription.description); Log.d(Config.LOGTAG, "debug print for sessionDescription:" + sessionDescription.description);

View File

@ -118,6 +118,8 @@ public class SessionDescription {
if (currentMediaBuilder != null) { if (currentMediaBuilder != null) {
currentMediaBuilder.setAttributes(attributeMap); currentMediaBuilder.setAttributes(attributeMap);
mediaBuilder.add(currentMediaBuilder.createMedia()); mediaBuilder.add(currentMediaBuilder.createMedia());
} else {
sessionDescriptionBuilder.setAttributes(attributeMap);
} }
sessionDescriptionBuilder.setMedia(mediaBuilder.build()); sessionDescriptionBuilder.setMedia(mediaBuilder.build());
return sessionDescriptionBuilder.createSessionDescription(); return sessionDescriptionBuilder.createSessionDescription();
@ -130,12 +132,9 @@ public class SessionDescription {
final Group group = contentMap.group; final Group group = contentMap.group;
if (group != null) { if (group != null) {
attributeMap.put("group", group.getSemantics() + " " + Joiner.on(' ').join(group.getIdentificationTags())); attributeMap.put("group", group.getSemantics() + " " + Joiner.on(' ').join(group.getIdentificationTags()));
} else {
Log.d(Config.LOGTAG,"group was null");
} }
//random additional attributes attributeMap.put("msid-semantic", " WMS my-media-stream");
for (Map.Entry<String, RtpContentMap.DescriptionTransport> entry : contentMap.contents.entrySet()) { for (Map.Entry<String, RtpContentMap.DescriptionTransport> entry : contentMap.contents.entrySet()) {
final String name = entry.getKey(); final String name = entry.getKey();
@ -172,6 +171,7 @@ public class SessionDescription {
mediaAttributes.put("rtcp-fb", payloadType.getId() + " trr-int " + feedbackNegotiationTrrInt.getValue()); mediaAttributes.put("rtcp-fb", payloadType.getId() + " trr-int " + feedbackNegotiationTrrInt.getValue());
} }
} }
for (RtpDescription.FeedbackNegotiation feedbackNegotiation : description.getFeedbackNegotiations()) { for (RtpDescription.FeedbackNegotiation feedbackNegotiation : description.getFeedbackNegotiations()) {
mediaAttributes.put("rtcp-fb", "* " + feedbackNegotiation.getType() + (Strings.isNullOrEmpty(feedbackNegotiation.getSubType()) ? "" : " " + feedbackNegotiation.getSubType())); mediaAttributes.put("rtcp-fb", "* " + feedbackNegotiation.getType() + (Strings.isNullOrEmpty(feedbackNegotiation.getSubType()) ? "" : " " + feedbackNegotiation.getSubType()));
} }
@ -181,9 +181,16 @@ public class SessionDescription {
for (RtpDescription.RtpHeaderExtension extension : description.getHeaderExtensions()) { for (RtpDescription.RtpHeaderExtension extension : description.getHeaderExtensions()) {
mediaAttributes.put("extmap", extension.getId() + " " + extension.getUri()); mediaAttributes.put("extmap", extension.getId() + " " + extension.getUri());
} }
for (RtpDescription.Source source : description.getSources()) {
for (RtpDescription.Source.Parameter parameter : source.getParameters()) {
mediaAttributes.put("ssrc", source.getSsrcId() + " " + parameter.getParameterName() + ":" + parameter.getParameterValue());
}
}
mediaAttributes.put("mid", name); mediaAttributes.put("mid", name);
//random additional attributes //random additional attributes
mediaAttributes.put("rtcp", "9 IN IP4 0.0.0.0");
mediaAttributes.put("sendrecv", ""); mediaAttributes.put("sendrecv", "");
mediaAttributes.put("rtcp-mux", ""); mediaAttributes.put("rtcp-mux", "");
@ -227,8 +234,8 @@ public class SessionDescription {
final StringBuilder s = new StringBuilder() final StringBuilder s = new StringBuilder()
.append("v=").append(version).append(LINE_DIVIDER) .append("v=").append(version).append(LINE_DIVIDER)
.append("o=- 8770656990916039506 2 IN IP4 127.0.0.1").append(LINE_DIVIDER) //what ever that means .append("o=- 8770656990916039506 2 IN IP4 127.0.0.1").append(LINE_DIVIDER) //what ever that means
.append("t=0 0").append(LINE_DIVIDER) .append("s=").append(name).append(LINE_DIVIDER)
.append("s=").append(name).append(LINE_DIVIDER); .append("t=0 0").append(LINE_DIVIDER);
appendAttributes(s, attributes); appendAttributes(s, attributes);
for (Media media : this.media) { for (Media media : this.media) {
s.append("m=").append(media.media).append(' ').append(media.port).append(' ').append(media.protocol).append(' ').append(Joiner.on(' ').join(media.formats)).append(LINE_DIVIDER); s.append("m=").append(media.media).append(' ').append(media.port).append(' ').append(media.protocol).append(' ').append(Joiner.on(' ').join(media.formats)).append(LINE_DIVIDER);