recover from pre-jingle connection states (discover etc) into full fledged jingle connection
fixes #3847
This commit is contained in:
parent
f22e33e3ea
commit
1ae7d6be16
|
@ -371,15 +371,23 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
||||||
} else if (Intent.ACTION_VIEW.equals(action)) {
|
} else if (Intent.ACTION_VIEW.equals(action)) {
|
||||||
final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE);
|
final String extraLastState = intent.getStringExtra(EXTRA_LAST_REPORTED_STATE);
|
||||||
if (extraLastState != null) {
|
final RtpEndUserState state = extraLastState == null ? null : RtpEndUserState.valueOf(extraLastState);
|
||||||
|
if (state != null) {
|
||||||
Log.d(Config.LOGTAG, "restored last state from intent extra");
|
Log.d(Config.LOGTAG, "restored last state from intent extra");
|
||||||
RtpEndUserState state = RtpEndUserState.valueOf(extraLastState);
|
|
||||||
updateButtonConfiguration(state);
|
updateButtonConfiguration(state);
|
||||||
updateStateDisplay(state);
|
updateStateDisplay(state);
|
||||||
updateProfilePicture(state);
|
updateProfilePicture(state);
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
binding.with.setText(account.getRoster().getContact(with).getDisplayName());
|
||||||
|
if (xmppConnectionService.getJingleConnectionManager().fireJingleRtpConnectionStateUpdates()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (END_CARD.contains(state) || xmppConnectionService.getJingleConnectionManager().hasMatchingProposal(account, with)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.d(Config.LOGTAG, "restored state (" + state + ") was not an end card. finishing");
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,6 +456,21 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean fireJingleRtpConnectionStateUpdates() {
|
||||||
|
boolean firedUpdates = false;
|
||||||
|
for (final AbstractJingleConnection connection : this.connections.values()) {
|
||||||
|
if (connection instanceof JingleRtpConnection) {
|
||||||
|
final JingleRtpConnection jingleRtpConnection = (JingleRtpConnection) connection;
|
||||||
|
if (jingleRtpConnection.isTerminated()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
jingleRtpConnection.fireStateUpdate();
|
||||||
|
firedUpdates = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return firedUpdates;
|
||||||
|
}
|
||||||
|
|
||||||
void getPrimaryCandidate(final Account account, final boolean initiator, final OnPrimaryCandidateFound listener) {
|
void getPrimaryCandidate(final Account account, final boolean initiator, final OnPrimaryCandidateFound listener) {
|
||||||
if (Config.DISABLE_PROXY_LOOKUP) {
|
if (Config.DISABLE_PROXY_LOOKUP) {
|
||||||
listener.onPrimaryCandidateFound(false, null);
|
listener.onPrimaryCandidateFound(false, null);
|
||||||
|
@ -576,6 +591,18 @@ public class JingleConnectionManager extends AbstractConnectionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasMatchingProposal(final Account account, final Jid with) {
|
||||||
|
synchronized (this.rtpSessionProposals) {
|
||||||
|
for (Map.Entry<RtpSessionProposal, DeviceDiscoveryState> entry : this.rtpSessionProposals.entrySet()) {
|
||||||
|
final RtpSessionProposal proposal = entry.getKey();
|
||||||
|
if (proposal.account == account && with.asBareJid().equals(proposal.with)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void deliverIbbPacket(Account account, IqPacket packet) {
|
public void deliverIbbPacket(Account account, IqPacket packet) {
|
||||||
final String sid;
|
final String sid;
|
||||||
final Element payload;
|
final Element payload;
|
||||||
|
|
|
@ -1263,6 +1263,11 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
|
||||||
this.proposedMedia = media;
|
this.proposedMedia = media;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void fireStateUpdate() {
|
||||||
|
final RtpEndUserState endUserState = getEndUserState();
|
||||||
|
xmppConnectionService.notifyJingleRtpConnectionUpdate(id.account, id.with, id.sessionId, endUserState);
|
||||||
|
}
|
||||||
|
|
||||||
private interface OnIceServersDiscovered {
|
private interface OnIceServersDiscovered {
|
||||||
void onIceServersDiscovered(List<PeerConnection.IceServer> iceServers);
|
void onIceServersDiscovered(List<PeerConnection.IceServer> iceServers);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue