From 493ca68464f7028487355ad505ca624edecd1efd Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 13 Apr 2020 15:16:26 +0200 Subject: [PATCH] add in description --- .../eu/siacs/conversations/ui/RtpSessionActivity.java | 4 +++- .../conversations/xmpp/jingle/SessionDescription.java | 5 +---- .../xmpp/jingle/stanzas/RtpDescription.java | 9 ++++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java index 2d31274cb..3fdc765cf 100644 --- a/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java @@ -102,6 +102,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe private void requestPermissionsAndAcceptCall() { if (PermissionUtils.hasPermission(this, ImmutableList.of(Manifest.permission.RECORD_AUDIO), REQUEST_ACCEPT_CALL)) { + //TODO like wise the propose; we might just wait here for the audio manager to come up putScreenInCallMode(); requireRtpConnection().acceptCall(); } @@ -111,7 +112,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe private void putScreenInCallMode() { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); final JingleRtpConnection rtpConnection = rtpConnectionReference != null ? rtpConnectionReference.get() : null; - if (rtpConnection == null || rtpConnection.getAudioManager().getSelectedAudioDevice() == AppRTCAudioManager.AudioDevice.EARPIECE) { + final AppRTCAudioManager audioManager = rtpConnection == null ? null : rtpConnection.getAudioManager(); + if (audioManager == null || audioManager.getSelectedAudioDevice() == AppRTCAudioManager.AudioDevice.EARPIECE) { acquireProximityWakeLock(); } } diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java index 62424e81f..dc4007d69 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/SessionDescription.java @@ -139,10 +139,7 @@ public class SessionDescription { attributeMap.put("msid-semantic", " WMS my-media-stream"); - for (Map.Entry entry : contentMap.contents.entrySet()) { - - //TODO sprinkle in a few noWhiteSpaces checks into various parameters and types - + for (final Map.Entry entry : contentMap.contents.entrySet()) { final String name = entry.getKey(); RtpContentMap.DescriptionTransport descriptionTransport = entry.getValue(); RtpDescription description = descriptionTransport.description; diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java index 5f1a76af9..3351e9301 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/stanzas/RtpDescription.java @@ -235,7 +235,7 @@ public class RtpDescription extends GenericDescription { final String name = getPayloadTypeName(); Preconditions.checkArgument(name != null, "Payload-type name must not be empty"); SessionDescription.checkNoWhitespace(name, "payload-type name must not contain whitespaces"); - return getId()+" "+name+"/"+getClockRate()+(channels == 1 ? "" : "/"+channels); + return getId() + " " + name + "/" + getClockRate() + (channels == 1 ? "" : "/" + channels); } public int getIntId() { @@ -368,7 +368,7 @@ public class RtpDescription extends GenericDescription { public static String toSdpString(final String id, List parameters) { final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(id).append(' '); - for(int i = 0; i < parameters.size(); ++i) { + for (int i = 0; i < parameters.size(); ++i) { Parameter p = parameters.get(i); final String name = p.getParameterName(); Preconditions.checkArgument(name != null, String.format("parameter for %s must have a name", id)); @@ -488,7 +488,7 @@ public class RtpDescription extends GenericDescription { public List getSsrcs() { ImmutableList.Builder builder = new ImmutableList.Builder<>(); - for(Element child : this.children) { + for (Element child : this.children) { if ("source".equals(child.getName())) { final String ssrc = child.getAttribute("ssrc"); if (ssrc != null) { @@ -580,6 +580,9 @@ public class RtpDescription extends GenericDescription { for (Map.Entry> source : sourceParameterMap.asMap().entrySet()) { rtpDescription.addChild(new Source(source.getKey(), source.getValue())); } + if (media.attributes.containsKey("rtcp-mux")) { + rtpDescription.addChild("rtcp-mux"); + } return rtpDescription; }