Search in sources :

Example 11 with GroupCall

use of org.signal.ringrtc.GroupCall in project Signal-Android by signalapp.

the class GroupPreJoinActionProcessor method handleGroupLocalDeviceStateChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupLocalDeviceStateChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupLocalDeviceStateChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    GroupCall.LocalDeviceState device = groupCall.getLocalDeviceState();
    Log.i(tag, "local device changed: " + device.getConnectionState() + " " + device.getJoinState());
    return currentState.builder().changeCallInfoState().groupCallState(WebRtcUtil.groupCallStateForConnection(device.getConnectionState())).build();
}
Also used : GroupCall(org.signal.ringrtc.GroupCall) NonNull(androidx.annotation.NonNull)

Example 12 with GroupCall

use of org.signal.ringrtc.GroupCall in project Signal-Android by signalapp.

the class GroupPreJoinActionProcessor method handleGroupJoinedMembershipChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupJoinedMembershipChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupJoinedMembershipChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    PeekInfo peekInfo = groupCall.getPeekInfo();
    if (peekInfo == null) {
        Log.i(tag, "No peek info available");
        return currentState;
    }
    List<Recipient> callParticipants = Stream.of(peekInfo.getJoinedMembers()).map(uuid -> Recipient.externalPush(ACI.from(uuid), null, false)).toList();
    WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder().changeCallInfoState().remoteDevicesCount(peekInfo.getDeviceCount()).participantLimit(peekInfo.getMaxDevices()).clearParticipantMap();
    for (Recipient recipient : callParticipants) {
        builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(), true, true, 0, false, 0, false, CallParticipant.DeviceOrdinal.PRIMARY));
    }
    return builder.build();
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) Stream(com.annimon.stream.Stream) ACI(org.whispersystems.signalservice.api.push.ACI) NonNull(androidx.annotation.NonNull) WebRtcViewModel(org.thoughtcrime.securesms.events.WebRtcViewModel) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) TYPE_OUTGOING_RINGING(org.thoughtcrime.securesms.webrtc.CallNotificationBuilder.TYPE_OUTGOING_RINGING) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) OfferMessage(org.whispersystems.signalservice.api.messages.calls.OfferMessage) EglBaseWrapper(org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper) CallException(org.signal.ringrtc.CallException) GroupCall(org.signal.ringrtc.GroupCall) Log(org.signal.core.util.logging.Log) List(java.util.List) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) PeekInfo(org.signal.ringrtc.PeekInfo) NetworkUtil(org.thoughtcrime.securesms.util.NetworkUtil) Recipient(org.thoughtcrime.securesms.recipients.Recipient) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) GroupCall(org.signal.ringrtc.GroupCall) PeekInfo(org.signal.ringrtc.PeekInfo) Recipient(org.thoughtcrime.securesms.recipients.Recipient) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) NonNull(androidx.annotation.NonNull)

Example 13 with GroupCall

use of org.signal.ringrtc.GroupCall in project Signal-Android by signalapp.

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));
}
Also used : CallException(org.signal.ringrtc.CallException) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) GroupCall(org.signal.ringrtc.GroupCall) NonNull(androidx.annotation.NonNull)

Example 14 with GroupCall

use of org.signal.ringrtc.GroupCall in project Signal-Android by signalapp.

the class GroupConnectedActionProcessor method handleSetEnableVideo.

@Override
@NonNull
protected WebRtcServiceState handleSetEnableVideo(@NonNull WebRtcServiceState currentState, boolean enable) {
    Log.i(TAG, "handleSetEnableVideo():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    Camera camera = currentState.getVideoState().requireCamera();
    try {
        groupCall.setOutgoingVideoMuted(!enable);
    } catch (CallException e) {
        return groupCallFailure(currentState, "Unable set video muted", e);
    }
    camera.setEnabled(enable);
    currentState = currentState.builder().changeLocalDeviceState().cameraState(camera.getCameraState()).build();
    WebRtcUtil.enableSpeakerPhoneIfNeeded(webRtcInteractor, currentState);
    return currentState;
}
Also used : CallException(org.signal.ringrtc.CallException) GroupCall(org.signal.ringrtc.GroupCall) Camera(org.thoughtcrime.securesms.ringrtc.Camera) NonNull(androidx.annotation.NonNull)

Example 15 with GroupCall

use of org.signal.ringrtc.GroupCall in project Signal-Android by signalapp.

the class GroupNetworkUnavailableActionProcessor method handlePreJoinCall.

@Override
@NonNull
protected WebRtcServiceState handlePreJoinCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer) {
    Log.i(TAG, "handlePreJoinCall():");
    ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    if (activeNetworkInfo != null && activeNetworkInfo.isConnected()) {
        GroupPreJoinActionProcessor processor = new GroupPreJoinActionProcessor(webRtcInteractor);
        return processor.handlePreJoinCall(currentState.builder().actionProcessor(processor).build(), remotePeer);
    }
    byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId();
    GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId, SignalStore.internalValues().groupCallingServer(), new byte[0], null, AudioProcessingMethodSelector.get(), webRtcInteractor.getGroupCallObserver());
    return currentState.builder().changeCallInfoState().callState(WebRtcViewModel.State.NETWORK_FAILURE).groupCall(groupCall).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).build();
}
Also used : NetworkInfo(android.net.NetworkInfo) ConnectivityManager(android.net.ConnectivityManager) GroupCall(org.signal.ringrtc.GroupCall) NonNull(androidx.annotation.NonNull)

Aggregations

GroupCall (org.signal.ringrtc.GroupCall)42 NonNull (androidx.annotation.NonNull)40 CallException (org.signal.ringrtc.CallException)30 Recipient (org.thoughtcrime.securesms.recipients.Recipient)14 RemotePeer (org.thoughtcrime.securesms.ringrtc.RemotePeer)10 ArrayList (java.util.ArrayList)8 WebRtcViewModel (org.thoughtcrime.securesms.events.WebRtcViewModel)8 WebRtcServiceState (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState)8 WebRtcServiceStateBuilder (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder)8 Stream (com.annimon.stream.Stream)6 List (java.util.List)6 Log (org.signal.core.util.logging.Log)6 PeekInfo (org.signal.ringrtc.PeekInfo)6 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)6 CallParticipant (org.thoughtcrime.securesms.events.CallParticipant)6 CallParticipantId (org.thoughtcrime.securesms.events.CallParticipantId)6 Camera (org.thoughtcrime.securesms.ringrtc.Camera)6 HashSet (java.util.HashSet)4 UUID (java.util.UUID)4 VideoState (org.thoughtcrime.securesms.service.webrtc.state.VideoState)4