@@ -145,9 +145,7 @@ import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.forms.Data;
import eu.siacs.conversations.xmpp.jingle.AbstractJingleConnection;
import eu.siacs.conversations.xmpp.jingle.JingleConnectionManager;
-import eu.siacs.conversations.xmpp.jingle.OnJinglePacketReceived;
import eu.siacs.conversations.xmpp.jingle.RtpEndUserState;
-import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
import eu.siacs.conversations.xmpp.mam.MamReference;
import eu.siacs.conversations.xmpp.pep.Avatar;
import eu.siacs.conversations.xmpp.pep.PublishOptions;
@@ -314,7 +312,7 @@ public class XmppConnectionService extends Service {
synchronized (account.inProgressConferencePings) {
account.inProgressConferencePings.clear();
}
- mJingleConnectionManager.cancelInTransmission();
+ mJingleConnectionManager.notifyRebound();
mQuickConversationsService.considerSyncBackground(false);
fetchRosterFromServer(account);
@@ -376,11 +376,9 @@ public class JingleConnectionManager extends AbstractConnectionManager {
account.getXmppConnection().sendIqPacket(packet.generateResponse(IqPacket.TYPE.ERROR), null);
}
- public void cancelInTransmission() {
- for (AbstractJingleConnection connection : this.connections.values()) {
- /*if (connection.getJingleStatus() == JingleFileTransferConnection.JINGLE_STATUS_TRANSMITTING) {
- connection.abort("connectivity-error");
- }*/
+ public void notifyRebound() {
+ for (final AbstractJingleConnection connection : this.connections.values()) {
+ connection.notifyRebound();
}
}
@@ -293,6 +293,13 @@ public class JingleFileTransferConnection extends AbstractJingleConnection imple
}
}
+ @Override
+ void notifyRebound() {
+ if (getJingleStatus() == JINGLE_STATUS_TRANSMITTING) {
+ abort(Reason.CONNECTIVITY_ERROR);
+ }
+ }
+
private void respondToIq(final IqPacket packet, final boolean result) {
final IqPacket response;
if (result) {
@@ -65,7 +65,8 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
State.PROCEED,
State.REJECTED,
State.RETRACTED,
- State.TERMINATED_APPLICATION_FAILURE
+ State.TERMINATED_APPLICATION_FAILURE,
+ State.TERMINATED_CONNECTIVITY_ERROR //only used when the xmpp connection rebinds
));
transitionBuilder.put(State.PROCEED, ImmutableList.of(
State.SESSION_INITIALIZED_PRE_APPROVED,
@@ -164,6 +165,24 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
}
}
+ @Override
+ void notifyRebound() {
+ if (TERMINATED.contains(this.state)) {
+ return;
+ }
+ webRTCWrapper.close();
+ if (!isInitiator() && isInState(State.PROPOSED,State.SESSION_INITIALIZED)) {
+ xmppConnectionService.getNotificationService().cancelIncomingCallNotification();
+ }
+ if (isInState(State.SESSION_INITIALIZED, State.SESSION_INITIALIZED_PRE_APPROVED, State.SESSION_ACCEPTED)) {
+ //we might have already changed resources (full jid) at this point; so this might not even reach the other party
+ sendSessionTerminate(Reason.CONNECTIVITY_ERROR);
+ } else {
+ transitionOrThrow(State.TERMINATED_CONNECTIVITY_ERROR);
+ jingleConnectionManager.finishConnection(this);
+ }
+ }
+
private void receiveSessionTerminate(final JinglePacket jinglePacket) {
respondOk(jinglePacket);
final JinglePacket.ReasonWrapper wrapper = jinglePacket.getReason();
@@ -496,7 +515,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
if (from.equals(id.with)) {
if (transition(State.RETRACTED)) {
xmppConnectionService.getNotificationService().cancelIncomingCallNotification();
- Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": session with " + id.with + " has been retracted (serverMsgId="+serverMsgId+")");
+ Log.d(Config.LOGTAG, id.account.getJid().asBareJid() + ": session with " + id.with + " has been retracted (serverMsgId=" + serverMsgId + ")");
if (serverMsgId != null) {
this.message.setServerMsgId(serverMsgId);
}
@@ -559,7 +578,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
final JinglePacket jinglePacket = new JinglePacket(JinglePacket.Action.SESSION_TERMINATE, id.sessionId);
jinglePacket.setReason(reason, text);
send(jinglePacket);
- Log.d(Config.LOGTAG, jinglePacket.toString());
jingleConnectionManager.finishConnection(this);
}
@@ -837,14 +855,14 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
return webRTCWrapper.getAudioManager();
}
- public void setMicrophoneEnabled(final boolean enabled) {
- webRTCWrapper.setMicrophoneEnabled(enabled);
- }
-
public boolean isMicrophoneEnabled() {
return webRTCWrapper.isMicrophoneEnabled();
}
+ public void setMicrophoneEnabled(final boolean enabled) {
+ webRTCWrapper.setMicrophoneEnabled(enabled);
+ }
+
@Override
public void onAudioDeviceChanged(AppRTCAudioManager.AudioDevice selectedAudioDevice, Set<AppRTCAudioManager.AudioDevice> availableAudioDevices) {
xmppConnectionService.notifyJingleRtpConnectionUpdate(selectedAudioDevice, availableAudioDevices);
@@ -934,7 +952,7 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
}
private void writeLogMessageMissed() {
- this.message.setBody(new RtpSessionStatus(false,0).toString());
+ this.message.setBody(new RtpSessionStatus(false, 0).toString());
this.writeMessage();
}
@@ -50,7 +50,9 @@ public class WebRTCWrapper {
@Override
public void onSignalingChange(PeerConnection.SignalingState signalingState) {
Log.d(Config.LOGTAG, "onSignalingChange(" + signalingState + ")");
-
+ //this is called after removeTrack or addTrack
+ //and should then trigger a content-add or content-remove or something
+ //https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/removeTrack
}
@Override