parent
36da1c3a89
commit
4ef4207593
|
@ -217,7 +217,7 @@ public class RtpSessionActivity extends XmppActivity
|
|||
if (connection == null) {
|
||||
return false;
|
||||
}
|
||||
return Media.audioOnly(connection.getMedia()) && STATES_CONSIDERED_CONNECTED.contains(connection.getEndUserState());
|
||||
return connection.isSwitchToVideoAvailable();
|
||||
}
|
||||
|
||||
private void switchToConversation() {
|
||||
|
|
|
@ -45,10 +45,13 @@ import eu.siacs.conversations.crypto.axolotl.AxolotlService;
|
|||
import eu.siacs.conversations.crypto.axolotl.CryptoFailedException;
|
||||
import eu.siacs.conversations.crypto.axolotl.FingerprintStatus;
|
||||
import eu.siacs.conversations.entities.Account;
|
||||
import eu.siacs.conversations.entities.Contact;
|
||||
import eu.siacs.conversations.entities.Conversation;
|
||||
import eu.siacs.conversations.entities.Conversational;
|
||||
import eu.siacs.conversations.entities.Message;
|
||||
import eu.siacs.conversations.entities.Presence;
|
||||
import eu.siacs.conversations.entities.RtpSessionStatus;
|
||||
import eu.siacs.conversations.entities.ServiceDiscoveryResult;
|
||||
import eu.siacs.conversations.services.AppRTCAudioManager;
|
||||
import eu.siacs.conversations.utils.IP;
|
||||
import eu.siacs.conversations.xml.Element;
|
||||
|
@ -2763,6 +2766,25 @@ public class JingleRtpConnection extends AbstractJingleConnection
|
|||
id.account, id.with, id.sessionId, endUserState);
|
||||
}
|
||||
|
||||
public boolean isSwitchToVideoAvailable() {
|
||||
final boolean prerequisite =
|
||||
Media.audioOnly(getMedia())
|
||||
&& Arrays.asList(RtpEndUserState.CONNECTED, RtpEndUserState.RECONNECTING)
|
||||
.contains(getEndUserState());
|
||||
return prerequisite && remoteHasVideoFeature();
|
||||
}
|
||||
|
||||
private boolean remoteHasVideoFeature() {
|
||||
final Contact contact = id.getContact();
|
||||
final Presence presence =
|
||||
contact.getPresences().get(Strings.nullToEmpty(id.with.getResource()));
|
||||
final ServiceDiscoveryResult serviceDiscoveryResult =
|
||||
presence == null ? null : presence.getServiceDiscoveryResult();
|
||||
final List<String> features =
|
||||
serviceDiscoveryResult == null ? null : serviceDiscoveryResult.getFeatures();
|
||||
return features != null && features.contains(Namespace.JINGLE_FEATURE_VIDEO);
|
||||
}
|
||||
|
||||
private interface OnIceServersDiscovered {
|
||||
void onIceServersDiscovered(List<PeerConnection.IceServer> iceServers);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue