use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by WhisperSystems.
the class GroupPreJoinActionProcessor method handleCancelPreJoinCall.
@Override
@NonNull
protected WebRtcServiceState handleCancelPreJoinCall(@NonNull WebRtcServiceState currentState) {
Log.i(TAG, "handleCancelPreJoinCall():");
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
try {
groupCall.disconnect();
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to disconnect from group call", e);
}
WebRtcVideoUtil.deinitializeVideo(currentState);
EglBaseWrapper.releaseEglBase(RemotePeer.GROUP_CALL_ID.longValue());
return new WebRtcServiceState(new IdleActionProcessor(webRtcInteractor));
}
use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by WhisperSystems.
the class SignalCallManager method process.
private void process(@NonNull ProcessAction action) {
Throwable t = new Throwable();
String caller = t.getStackTrace().length > 1 ? t.getStackTrace()[1].getMethodName() : "unknown";
if (callManager == null) {
Log.w(TAG, "Unable to process action, call manager is not initialized");
return;
}
serviceExecutor.execute(() -> {
if (needsToSetSelfUuid) {
try {
callManager.setSelfUuid(Recipient.self().requireServiceId().uuid());
needsToSetSelfUuid = false;
} catch (CallException e) {
Log.w(TAG, "Unable to set self UUID on CallManager", e);
}
}
Log.v(TAG, "Processing action: " + caller + ", handler: " + serviceState.getActionProcessor().getTag());
WebRtcServiceState previous = serviceState;
serviceState = action.process(previous, previous.getActionProcessor());
if (previous != serviceState) {
if (serviceState.getCallInfoState().getCallState() != WebRtcViewModel.State.IDLE) {
postStateUpdate(serviceState);
}
}
});
}
use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by WhisperSystems.
the class GroupActionProcessor method handleGroupRequestUpdateMembers.
@Override
@NonNull
protected WebRtcServiceState handleGroupRequestUpdateMembers(@NonNull WebRtcServiceState currentState) {
Log.i(tag, "handleGroupRequestUpdateMembers():");
Recipient group = currentState.getCallInfoState().getCallRecipient();
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
List<GroupCall.GroupMemberInfo> members = Stream.of(GroupManager.getUuidCipherTexts(context, group.requireGroupId().requireV2())).map(entry -> new GroupCall.GroupMemberInfo(entry.getKey(), entry.getValue().serialize())).toList();
try {
groupCall.setGroupMembers(new ArrayList<>(members));
} catch (CallException e) {
return groupCallFailure(currentState, "Unable set group members", e);
}
return currentState;
}
use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState 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;
}
use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by WhisperSystems.
the class GroupConnectedActionProcessor method handleLocalHangup.
@Override
@NonNull
protected WebRtcServiceState handleLocalHangup(@NonNull WebRtcServiceState currentState) {
Log.i(TAG, "handleLocalHangup():");
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
try {
groupCall.disconnect();
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to disconnect from group call", e);
}
String eraId = WebRtcUtil.getGroupCallEraId(groupCall);
webRtcInteractor.sendGroupCallMessage(currentState.getCallInfoState().getCallRecipient(), eraId);
List<UUID> members = Stream.of(currentState.getCallInfoState().getRemoteCallParticipants()).map(p -> p.getRecipient().requireServiceId().uuid()).toList();
webRtcInteractor.updateGroupCallUpdateMessage(currentState.getCallInfoState().getCallRecipient().getId(), eraId, members, false);
currentState = currentState.builder().changeCallInfoState().callState(WebRtcViewModel.State.CALL_DISCONNECTED).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).build();
webRtcInteractor.postStateUpdate(currentState);
return terminateGroupCall(currentState);
}
Aggregations