Search in sources :

Example 41 with GroupCall

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

the class GroupPreJoinActionProcessor method handlePreJoinCall.

@Override
@NonNull
protected WebRtcServiceState handlePreJoinCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer) {
    Log.i(TAG, "handlePreJoinCall():");
    byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId();
    GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId, SignalStore.internalValues().groupCallingServer(), new byte[0], null, AudioProcessingMethodSelector.get(), webRtcInteractor.getGroupCallObserver());
    try {
        groupCall.setOutgoingAudioMuted(true);
        groupCall.setOutgoingVideoMuted(true);
        groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
        Log.i(TAG, "Connecting to group call: " + currentState.getCallInfoState().getCallRecipient().getId());
        groupCall.connect();
    } catch (CallException e) {
        return groupCallFailure(currentState, "Unable to connect to group call", e);
    }
    SignalStore.tooltips().markGroupCallingLobbyEntered();
    return currentState.builder().changeCallInfoState().groupCall(groupCall).groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED).activePeer(new RemotePeer(currentState.getCallInfoState().getCallRecipient().getId(), RemotePeer.GROUP_CALL_ID)).build();
}
Also used : CallException(org.signal.ringrtc.CallException) GroupCall(org.signal.ringrtc.GroupCall) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) NonNull(androidx.annotation.NonNull)

Example 42 with GroupCall

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

the class GroupPreJoinActionProcessor method handleOutgoingCall.

@Override
@NonNull
protected WebRtcServiceState handleOutgoingCall(@NonNull WebRtcServiceState currentState, @NonNull RemotePeer remotePeer, @NonNull OfferMessage.Type offerType) {
    Log.i(TAG, "handleOutgoingCall():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    currentState = WebRtcVideoUtil.reinitializeCamera(context, webRtcInteractor.getCameraEventListener(), currentState);
    webRtcInteractor.setCallInProgressNotification(TYPE_OUTGOING_RINGING, currentState.getCallInfoState().getCallRecipient());
    webRtcInteractor.updatePhoneState(WebRtcUtil.getInCallPhoneState(context));
    webRtcInteractor.initializeAudioForCall();
    try {
        groupCall.setOutgoingVideoSource(currentState.getVideoState().requireLocalSink(), currentState.getVideoState().requireCamera());
        groupCall.setOutgoingVideoMuted(!currentState.getLocalDeviceState().getCameraState().isEnabled());
        groupCall.setOutgoingAudioMuted(!currentState.getLocalDeviceState().isMicrophoneEnabled());
        groupCall.setBandwidthMode(NetworkUtil.getCallingBandwidthMode(context, groupCall.getLocalDeviceState().getNetworkRoute().getLocalAdapterType()));
        groupCall.join();
    } catch (CallException e) {
        return groupCallFailure(currentState, "Unable to join group call", e);
    }
    return currentState.builder().actionProcessor(new GroupJoiningActionProcessor(webRtcInteractor)).changeCallInfoState().callState(WebRtcViewModel.State.CALL_OUTGOING).groupCallState(WebRtcViewModel.GroupCallState.CONNECTED_AND_JOINING).commit().changeLocalDeviceState().build();
}
Also used : CallException(org.signal.ringrtc.CallException) 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