Revert "We can now send trickle ice candidates immediately"

Need to hold off on this for some iOS changes.

This reverts commit 338f8de7874c31b862af7da1bea0a4cd8472e6af.
This commit is contained in:
Moxie Marlinspike 2017-07-12 10:59:10 -07:00
parent 666f648c59
commit 34443b059c

View File

@ -170,6 +170,7 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
@Nullable private Recipient recipient; @Nullable private Recipient recipient;
@Nullable private PeerConnectionWrapper peerConnection; @Nullable private PeerConnectionWrapper peerConnection;
@Nullable private DataChannel dataChannel; @Nullable private DataChannel dataChannel;
@Nullable private List<IceUpdateMessage> pendingIceUpdates;
@Nullable public static SurfaceViewRenderer localRenderer; @Nullable public static SurfaceViewRenderer localRenderer;
@Nullable public static SurfaceViewRenderer remoteRenderer; @Nullable public static SurfaceViewRenderer remoteRenderer;
@ -382,6 +383,7 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
this.callState = CallState.STATE_DIALING; this.callState = CallState.STATE_DIALING;
this.recipient = getRemoteRecipient(intent); this.recipient = getRemoteRecipient(intent);
this.callId = SecureRandom.getInstance("SHA1PRNG").nextLong(); this.callId = SecureRandom.getInstance("SHA1PRNG").nextLong();
this.pendingIceUpdates = new LinkedList<>();
initializeVideo(); initializeVideo();
@ -449,11 +451,26 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
return; return;
} }
if (peerConnection == null) { if (peerConnection == null || pendingIceUpdates == null) {
throw new AssertionError("assert"); throw new AssertionError("assert");
} }
if (!pendingIceUpdates.isEmpty()) {
ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdates(pendingIceUpdates));
listenableFutureTask.addListener(new FailureListener<Boolean>(callState, callId) {
@Override
public void onFailureContinue(Throwable error) {
Log.w(TAG, error);
sendMessage(WebRtcViewModel.State.NETWORK_FAILURE, recipient, localVideoEnabled, remoteVideoEnabled, bluetoothAvailable, microphoneEnabled);
terminate();
}
});
}
this.peerConnection.setRemoteDescription(new SessionDescription(SessionDescription.Type.ANSWER, intent.getStringExtra(EXTRA_REMOTE_DESCRIPTION))); this.peerConnection.setRemoteDescription(new SessionDescription(SessionDescription.Type.ANSWER, intent.getStringExtra(EXTRA_REMOTE_DESCRIPTION)));
this.pendingIceUpdates = null;
} catch (PeerConnectionException e) { } catch (PeerConnectionException e) {
Log.w(TAG, e); Log.w(TAG, e);
terminate(); terminate();
@ -484,6 +501,12 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0),
intent.getStringExtra(EXTRA_ICE_SDP)); intent.getStringExtra(EXTRA_ICE_SDP));
if (pendingIceUpdates != null) {
Log.w(TAG, "Adding to pending ice candidates...");
this.pendingIceUpdates.add(iceUpdateMessage);
return;
}
ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage)); ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage));
listenableFutureTask.addListener(new FailureListener<Boolean>(callState, callId) { listenableFutureTask.addListener(new FailureListener<Boolean>(callState, callId) {
@ -863,6 +886,7 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo
this.microphoneEnabled = true; this.microphoneEnabled = true;
this.localVideoEnabled = false; this.localVideoEnabled = false;
this.remoteVideoEnabled = false; this.remoteVideoEnabled = false;
this.pendingIceUpdates = null;
lockManager.updatePhoneState(LockManager.PhoneState.IDLE); lockManager.updatePhoneState(LockManager.PhoneState.IDLE);
} }