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) {
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();
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);

View File

@ -118,6 +118,8 @@ public class SessionDescription {
if (currentMediaBuilder != null) {
currentMediaBuilder.setAttributes(attributeMap);
mediaBuilder.add(currentMediaBuilder.createMedia());
} else {
sessionDescriptionBuilder.setAttributes(attributeMap);
}
sessionDescriptionBuilder.setMedia(mediaBuilder.build());
return sessionDescriptionBuilder.createSessionDescription();
@ -130,12 +132,9 @@ public class SessionDescription {
final Group group = contentMap.group;
if (group != null) {
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()) {
final String name = entry.getKey();
@ -172,6 +171,7 @@ public class SessionDescription {
mediaAttributes.put("rtcp-fb", payloadType.getId() + " trr-int " + feedbackNegotiationTrrInt.getValue());
}
}
for (RtpDescription.FeedbackNegotiation feedbackNegotiation : description.getFeedbackNegotiations()) {
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()) {
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);
//random additional attributes
mediaAttributes.put("rtcp", "9 IN IP4 0.0.0.0");
mediaAttributes.put("sendrecv", "");
mediaAttributes.put("rtcp-mux", "");
@ -227,8 +234,8 @@ public class SessionDescription {
final StringBuilder s = new StringBuilder()
.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("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);
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);