use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.
the class MessageContentProcessor method handleCallIceUpdateMessage.
private void handleCallIceUpdateMessage(@NonNull SignalServiceContent content, @NonNull List<IceUpdateMessage> messages, @NonNull Recipient senderRecipient) {
log(String.valueOf(content), "handleCallIceUpdateMessage... " + messages.size());
List<byte[]> iceCandidates = new ArrayList<>(messages.size());
long callId = -1;
for (IceUpdateMessage iceMessage : messages) {
iceCandidates.add(iceMessage.getOpaque());
callId = iceMessage.getId();
}
RemotePeer remotePeer = new RemotePeer(senderRecipient.getId(), new CallId(callId));
ApplicationDependencies.getSignalCallManager().receivedIceCandidates(new WebRtcData.CallMetadata(remotePeer, content.getSenderDevice()), iceCandidates);
}
use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by WhisperSystems.
the class WebRtcCallService method handleLocalIceCandidate.
private void handleLocalIceCandidate(Intent intent) {
if (callState == CallState.STATE_IDLE || !Util.isEquals(this.callId, getCallId(intent))) {
Log.w(TAG, "State is now idle, ignoring ice candidate...");
}
if (recipient == null || callId == null) {
throw new AssertionError("assert: " + callState + ", " + callId);
}
IceUpdateMessage iceUpdateMessage = new IceUpdateMessage(this.callId, intent.getStringExtra(EXTRA_ICE_SDP_MID), intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getStringExtra(EXTRA_ICE_SDP));
if (pendingIceUpdates != null) {
this.pendingIceUpdates.add(iceUpdateMessage);
return;
}
ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage));
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();
}
});
}
use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.
the class WebRtcCallService method handleLocalIceCandidate.
private void handleLocalIceCandidate(Intent intent) {
if (callState == CallState.STATE_IDLE || !Util.isEquals(this.callId, getCallId(intent))) {
Log.w(TAG, "State is now idle, ignoring ice candidate...");
return;
}
if (recipient == null || callId == null) {
throw new AssertionError("assert: " + callState + ", " + callId);
}
IceUpdateMessage iceUpdateMessage = new IceUpdateMessage(this.callId, intent.getStringExtra(EXTRA_ICE_SDP_MID), intent.getIntExtra(EXTRA_ICE_SDP_LINE_INDEX, 0), intent.getStringExtra(EXTRA_ICE_SDP));
if (pendingOutgoingIceUpdates != null) {
Log.w(TAG, "Adding to pending ice candidates...");
this.pendingOutgoingIceUpdates.add(iceUpdateMessage);
return;
}
ListenableFutureTask<Boolean> listenableFutureTask = sendMessage(recipient, SignalServiceCallMessage.forIceUpdate(iceUpdateMessage));
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();
}
});
}
use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by signalapp.
the class PushDecryptJob method handleCallIceUpdateMessage.
private void handleCallIceUpdateMessage(@NonNull SignalServiceEnvelope envelope, @NonNull List<IceUpdateMessage> messages) {
Log.w(TAG, "handleCallIceUpdateMessage... " + messages.size());
for (IceUpdateMessage message : messages) {
Intent intent = new Intent(context, WebRtcCallService.class);
intent.setAction(WebRtcCallService.ACTION_ICE_MESSAGE);
intent.putExtra(WebRtcCallService.EXTRA_CALL_ID, message.getId());
intent.putExtra(WebRtcCallService.EXTRA_REMOTE_ADDRESS, Address.fromExternal(context, envelope.getSource()));
intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP, message.getSdp());
intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_MID, message.getSdpMid());
intent.putExtra(WebRtcCallService.EXTRA_ICE_SDP_LINE_INDEX, message.getSdpMLineIndex());
context.startService(intent);
}
}
use of org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage in project Signal-Android by WhisperSystems.
the class WebRtcActionProcessor method handleSendIceCandidates.
// endregion Active call
// region Call setup
@NonNull
protected final WebRtcServiceState handleSendIceCandidates(@NonNull WebRtcServiceState currentState, @NonNull CallMetadata callMetadata, boolean broadcast, @NonNull List<byte[]> iceCandidates) {
Log.i(tag, "handleSendIceCandidates(): id: " + callMetadata.getCallId().format(callMetadata.getRemoteDevice()));
List<IceUpdateMessage> iceUpdateMessages = Stream.of(iceCandidates).map(c -> new IceUpdateMessage(callMetadata.getCallId().longValue(), c, null)).toList();
Integer destinationDeviceId = broadcast ? null : callMetadata.getRemoteDevice();
SignalServiceCallMessage callMessage = SignalServiceCallMessage.forIceUpdates(iceUpdateMessages, true, destinationDeviceId);
webRtcInteractor.sendCallMessage(callMetadata.getRemotePeer(), callMessage);
return currentState;
}
Aggregations