use of org.signal.ringrtc.CallException in project Signal-Android by signalapp.
the class WebRtcActionProcessor method groupCallFailure.
@NonNull
protected WebRtcServiceState groupCallFailure(@NonNull WebRtcServiceState currentState, @NonNull String message, @NonNull Throwable error) {
Log.w(tag, "groupCallFailure(): " + message, error);
GroupCall groupCall = currentState.getCallInfoState().getGroupCall();
Recipient recipient = currentState.getCallInfoState().getCallRecipient();
if (recipient != null && currentState.getCallInfoState().getGroupCallState().isConnected()) {
webRtcInteractor.sendGroupCallMessage(recipient, WebRtcUtil.getGroupCallEraId(groupCall));
}
currentState = currentState.builder().changeCallInfoState().callState(WebRtcViewModel.State.CALL_DISCONNECTED).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).build();
webRtcInteractor.postStateUpdate(currentState);
try {
if (groupCall != null) {
groupCall.disconnect();
}
webRtcInteractor.getCallManager().reset();
} catch (CallException e) {
Log.w(tag, "Unable to reset call manager: ", e);
}
return terminateGroupCall(currentState);
}
use of org.signal.ringrtc.CallException in project Signal-Android by signalapp.
the class WebRtcActionProcessor method callFailure.
// endregion
// region Global call operations
@NonNull
public WebRtcServiceState callFailure(@NonNull WebRtcServiceState currentState, @Nullable String message, @Nullable Throwable error) {
Log.w(tag, "callFailure(): " + message, error);
WebRtcServiceStateBuilder builder = currentState.builder();
if (currentState.getCallInfoState().getActivePeer() != null) {
builder.changeCallInfoState().callState(WebRtcViewModel.State.CALL_DISCONNECTED);
}
try {
webRtcInteractor.getCallManager().reset();
} catch (CallException e) {
Log.w(tag, "Unable to reset call manager: ", e);
}
EglBaseWrapper.forceRelease();
currentState = builder.changeCallInfoState().clearPeerMap().build();
return terminate(currentState, currentState.getCallInfoState().getActivePeer());
}
use of org.signal.ringrtc.CallException in project Signal-Android by signalapp.
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.signal.ringrtc.CallException in project Signal-Android by signalapp.
the class GroupActionProcessor method handleGroupCallEnded.
@Override
@NonNull
protected WebRtcServiceState handleGroupCallEnded(@NonNull WebRtcServiceState currentState, int groupCallHash, @NonNull GroupCall.GroupCallEndReason groupCallEndReason) {
Log.i(tag, "handleGroupCallEnded(): reason: " + groupCallEndReason);
GroupCall groupCall = currentState.getCallInfoState().getGroupCall();
if (groupCall == null || groupCall.hashCode() != groupCallHash) {
return currentState;
}
try {
groupCall.disconnect();
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to disconnect from group call", e);
}
if (groupCallEndReason != GroupCall.GroupCallEndReason.DEVICE_EXPLICITLY_DISCONNECTED) {
Log.i(tag, "Group call ended unexpectedly, reinitializing and dropping back to lobby");
Recipient currentRecipient = currentState.getCallInfoState().getCallRecipient();
VideoState videoState = currentState.getVideoState();
currentState = terminateGroupCall(currentState, false).builder().actionProcessor(new GroupNetworkUnavailableActionProcessor(webRtcInteractor)).changeVideoState().eglBase(videoState.getLockableEglBase()).camera(videoState.getCamera()).localSink(videoState.getLocalSink()).commit().changeCallInfoState().callState(WebRtcViewModel.State.CALL_PRE_JOIN).callRecipient(currentRecipient).build();
currentState = WebRtcVideoUtil.initializeVanityCamera(WebRtcVideoUtil.reinitializeCamera(context, webRtcInteractor.getCameraEventListener(), currentState));
return currentState.getActionProcessor().handlePreJoinCall(currentState, new RemotePeer(currentRecipient.getId()));
}
currentState = currentState.builder().changeCallInfoState().callState(WebRtcViewModel.State.CALL_DISCONNECTED).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).build();
webRtcInteractor.postStateUpdate(currentState);
return terminateGroupCall(currentState);
}
use of org.signal.ringrtc.CallException in project Signal-Android by signalapp.
the class GroupActionProcessor method handleGroupRequestMembershipProof.
@Override
@NonNull
protected WebRtcServiceState handleGroupRequestMembershipProof(@NonNull WebRtcServiceState currentState, int groupCallHash, @NonNull byte[] groupMembershipToken) {
Log.i(tag, "handleGroupRequestMembershipProof():");
GroupCall groupCall = currentState.getCallInfoState().getGroupCall();
if (groupCall == null || groupCall.hashCode() != groupCallHash) {
return currentState;
}
try {
groupCall.setMembershipProof(groupMembershipToken);
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to set group membership proof", e);
}
return currentState;
}
Aggregations