calculate switch to video cap on jingle connection startup
This commit is contained in:
parent
eafa93d132
commit
f5203b082b
|
@ -32,6 +32,7 @@ import im.conversations.android.axolotl.AxolotlService;
|
|||
import im.conversations.android.dns.IP;
|
||||
import im.conversations.android.notification.RtpSessionNotification;
|
||||
import im.conversations.android.transformer.CallLogEntry;
|
||||
import im.conversations.android.util.BooleanFutures;
|
||||
import im.conversations.android.xml.Element;
|
||||
import im.conversations.android.xml.Namespace;
|
||||
import im.conversations.android.xmpp.Entity;
|
||||
|
@ -179,6 +180,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
|
|||
private final RtpSessionNotification rtpSessionNotification;
|
||||
private ScheduledFuture<?> ringingTimeoutFuture;
|
||||
private CallLogEntry message = null;
|
||||
private final ListenableFuture<Boolean> remoteHasVideoFeature;
|
||||
|
||||
public JingleRtpConnection(
|
||||
final Context context,
|
||||
|
@ -186,7 +188,11 @@ public class JingleRtpConnection extends AbstractJingleConnection
|
|||
final Id id,
|
||||
final Jid initiator) {
|
||||
super(context, connection, id, initiator);
|
||||
this.rtpSessionNotification = new RtpSessionNotification(context);
|
||||
this.rtpSessionNotification =
|
||||
getManager(JingleConnectionManager.class).getNotificationService();
|
||||
this.remoteHasVideoFeature =
|
||||
getManager(DiscoManager.class)
|
||||
.hasFeatureAsync(Entity.presence(id.with), Namespace.JINGLE_FEATURE_VIDEO);
|
||||
}
|
||||
|
||||
private static State reasonToState(Reason reason) {
|
||||
|
@ -2662,8 +2668,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
|
|||
}
|
||||
|
||||
private boolean remoteHasVideoFeature() {
|
||||
return getManager(DiscoManager.class)
|
||||
.hasFeature(Entity.presence(id.with), Namespace.JINGLE_FEATURE_VIDEO);
|
||||
return BooleanFutures.isDoneAndTrue(this.remoteHasVideoFeature);
|
||||
}
|
||||
|
||||
private interface OnIceServersDiscovered {
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package im.conversations.android.util;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
public final class BooleanFutures {
|
||||
|
||||
private BooleanFutures() {}
|
||||
|
||||
public static boolean isDoneAndTrue(final ListenableFuture<Boolean> future) {
|
||||
if (future.isDone()) {
|
||||
try {
|
||||
return Boolean.TRUE.equals(future.get());
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,16 +4,14 @@ import android.content.Context;
|
|||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import im.conversations.android.xml.Namespace;
|
||||
import im.conversations.android.xmpp.XmppConnection;
|
||||
import im.conversations.android.xmpp.model.disco.external.Service;
|
||||
import im.conversations.android.xmpp.model.disco.external.Services;
|
||||
import im.conversations.android.xmpp.model.stanza.Iq;
|
||||
import java.util.Collection;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ExternalDiscoManager extends AbstractManager {
|
||||
|
||||
|
|
10
app/src/main/res/drawable/ic_assured_workload_24dp.xml
Normal file
10
app/src/main/res/drawable/ic_assured_workload_24dp.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M5,10h2v7h-2z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M11,10h2v7h-2z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M22,6l-10,-5l-10,5l0,2l20,0z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M2,19v2h12.4c-0.21,-0.64 -0.32,-1.31 -0.36,-2H2z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19,12.26l0,-2.26l-2,0l0,3.26z"/>
|
||||
<path android:fillColor="@android:color/white" android:pathData="M20,14l-4,2v2.55c0,2.52 1.71,4.88 4,5.45c2.29,-0.57 4,-2.93 4,-5.45V16L20,14zM19.28,21l-2.03,-2.03l1.06,-1.06l0.97,0.97l2.41,-2.38l1.06,1.06L19.28,21z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M18.93,11c-0.49,-3.39 -3.4,-6 -6.93,-6s-6.44,2.61 -6.93,6H2v2h3.07c0.49,3.39 3.4,6 6.93,6s6.44,-2.61 6.93,-6H22v-2H18.93zM15,14.5c0,0.55 -0.45,1 -1,1h-4c-0.55,0 -1,-0.45 -1,-1v-3c0,-0.55 0.45,-1 1,-1v-1c0,-1.21 1.08,-2.18 2.34,-1.97C13.32,7.69 14,8.61 14,9.61v0.89c0.55,0 1,0.45 1,1V14.5zM12.75,13c0,0.41 -0.34,0.75 -0.75,0.75s-0.75,-0.34 -0.75,-0.75c0,-0.41 0.34,-0.75 0.75,-0.75S12.75,12.59 12.75,13zM13,9.5v1h-2v-1c0,-0.55 0.45,-1 1,-1S13,8.95 13,9.5z"/>
|
||||
</vector>
|
Loading…
Reference in a new issue