From 338f8de7874c31b862af7da1bea0a4cd8472e6af Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 5 Jul 2017 14:06:31 -0700 Subject: [PATCH] We can now send trickle ice candidates immediately // FREEBIE --- .../securesms/service/WebRtcCallService.java | 26 +------------------ 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java index ef665ae106..1e03b498f6 100644 --- a/src/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/src/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -170,7 +170,6 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo @Nullable private Recipient recipient; @Nullable private PeerConnectionWrapper peerConnection; @Nullable private DataChannel dataChannel; - @Nullable private List pendingIceUpdates; @Nullable public static SurfaceViewRenderer localRenderer; @Nullable public static SurfaceViewRenderer remoteRenderer; @@ -383,7 +382,6 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo this.callState = CallState.STATE_DIALING; this.recipient = getRemoteRecipient(intent); this.callId = SecureRandom.getInstance("SHA1PRNG").nextLong(); - this.pendingIceUpdates = new LinkedList<>(); initializeVideo(); @@ -451,26 +449,11 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo return; } - if (peerConnection == null || pendingIceUpdates == null) { + if (peerConnection == null) { throw new AssertionError("assert"); } - if (!pendingIceUpdates.isEmpty()) { - ListenableFutureTask listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdates(pendingIceUpdates)); - - listenableFutureTask.addListener(new FailureListener(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.pendingIceUpdates = null; } catch (PeerConnectionException e) { Log.w(TAG, e); terminate(); @@ -501,12 +484,6 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getStringExtra(EXTRA_ICE_SDP)); - if (pendingIceUpdates != null) { - Log.w(TAG, "Adding to pending ice candidates..."); - this.pendingIceUpdates.add(iceUpdateMessage); - return; - } - ListenableFutureTask listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage)); listenableFutureTask.addListener(new FailureListener(callState, callId) { @@ -886,7 +863,6 @@ public class WebRtcCallService extends Service implements InjectableType, PeerCo this.microphoneEnabled = true; this.localVideoEnabled = false; this.remoteVideoEnabled = false; - this.pendingIceUpdates = null; lockManager.updatePhoneState(LockManager.PhoneState.IDLE); }