Search in sources :

Example 1 with CallParticipant

use of org.thoughtcrime.securesms.events.CallParticipant in project Signal-Android by WhisperSystems.

the class IncomingCallActionProcessor method handleTurnServerUpdate.

@Override
@NonNull
public WebRtcServiceState handleTurnServerUpdate(@NonNull WebRtcServiceState currentState, @NonNull List<PeerConnection.IceServer> iceServers, boolean isAlwaysTurn) {
    RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
    boolean hideIp = !activePeer.getRecipient().isSystemContact() || isAlwaysTurn;
    VideoState videoState = currentState.getVideoState();
    CallParticipant callParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
    try {
        webRtcInteractor.getCallManager().proceed(activePeer.getCallId(), context, videoState.getLockableEglBase().require(), AudioProcessingMethodSelector.get(), videoState.requireLocalSink(), callParticipant.getVideoSink(), videoState.requireCamera(), iceServers, hideIp, NetworkUtil.getCallingBandwidthMode(context), null, false);
    } catch (CallException e) {
        return callFailure(currentState, "Unable to proceed with call: ", e);
    }
    webRtcInteractor.updatePhoneState(LockManager.PhoneState.PROCESSING);
    webRtcInteractor.postStateUpdate(currentState);
    return currentState;
}
Also used : CallException(org.signal.ringrtc.CallException) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) VideoState(org.thoughtcrime.securesms.service.webrtc.state.VideoState) NonNull(androidx.annotation.NonNull)

Example 2 with CallParticipant

use of org.thoughtcrime.securesms.events.CallParticipant in project Signal-Android by WhisperSystems.

the class OutgoingCallActionProcessor method handleTurnServerUpdate.

@Override
@NonNull
public WebRtcServiceState handleTurnServerUpdate(@NonNull WebRtcServiceState currentState, @NonNull List<PeerConnection.IceServer> iceServers, boolean isAlwaysTurn) {
    try {
        VideoState videoState = currentState.getVideoState();
        RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
        CallParticipant callParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
        webRtcInteractor.getCallManager().proceed(activePeer.getCallId(), context, videoState.getLockableEglBase().require(), AudioProcessingMethodSelector.get(), videoState.requireLocalSink(), callParticipant.getVideoSink(), videoState.requireCamera(), iceServers, isAlwaysTurn, NetworkUtil.getCallingBandwidthMode(context), null, currentState.getCallSetupState(activePeer).isEnableVideoOnCreate());
    } catch (CallException e) {
        return callFailure(currentState, "Unable to proceed with call: ", e);
    }
    return currentState.builder().changeLocalDeviceState().cameraState(currentState.getVideoState().requireCamera().getCameraState()).build();
}
Also used : CallException(org.signal.ringrtc.CallException) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) VideoState(org.thoughtcrime.securesms.service.webrtc.state.VideoState) NonNull(androidx.annotation.NonNull)

Example 3 with CallParticipant

use of org.thoughtcrime.securesms.events.CallParticipant in project Signal-Android by WhisperSystems.

the class ActiveCallActionProcessorDelegate method handleScreenSharingEnable.

@Override
@NonNull
protected WebRtcServiceState handleScreenSharingEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
    RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
    Log.i(tag, "handleScreenSharingEnable(): call_id: " + activePeer.getCallId() + " enable: " + enable);
    CallParticipant oldParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
    CallParticipant newParticipant = oldParticipant.withScreenSharingEnabled(enable);
    return currentState.builder().changeCallInfoState().putParticipant(activePeer.getRecipient(), newParticipant).build();
}
Also used : CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) NonNull(androidx.annotation.NonNull)

Example 4 with CallParticipant

use of org.thoughtcrime.securesms.events.CallParticipant in project Signal-Android by WhisperSystems.

the class CallParticipantListUpdateTest method createWrappers.

static CallParticipantListUpdate.Wrapper[] createWrappers(long... recipientIds) {
    CallParticipantListUpdate.Wrapper[] ids = new CallParticipantListUpdate.Wrapper[recipientIds.length];
    Set<Long> primaries = new HashSet<>();
    for (int i = 0; i < recipientIds.length; i++) {
        CallParticipant participant = createParticipant(recipientIds[i], recipientIds[i], primaries.contains(recipientIds[i]) ? CallParticipant.DeviceOrdinal.SECONDARY : CallParticipant.DeviceOrdinal.PRIMARY);
        ids[i] = CallParticipantListUpdate.createWrapper(participant);
    }
    return ids;
}
Also used : CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) HashSet(java.util.HashSet)

Example 5 with CallParticipant

use of org.thoughtcrime.securesms.events.CallParticipant in project Signal-Android by WhisperSystems.

the class WebRtcActionProcessor method handleOrientationChanged.

@NonNull
protected WebRtcServiceState handleOrientationChanged(@NonNull WebRtcServiceState currentState, boolean isLandscapeEnabled, int orientationDegrees) {
    Camera camera = currentState.getVideoState().getCamera();
    if (camera != null) {
        camera.setOrientation(orientationDegrees);
    }
    int sinkRotationDegrees = isLandscapeEnabled ? BroadcastVideoSink.DEVICE_ROTATION_IGNORE : orientationDegrees;
    int stateRotationDegrees = isLandscapeEnabled ? 0 : orientationDegrees;
    BroadcastVideoSink sink = currentState.getVideoState().getLocalSink();
    if (sink != null) {
        sink.setDeviceOrientationDegrees(sinkRotationDegrees);
    }
    for (CallParticipant callParticipant : currentState.getCallInfoState().getRemoteCallParticipants()) {
        callParticipant.getVideoSink().setDeviceOrientationDegrees(sinkRotationDegrees);
    }
    return currentState.builder().changeLocalDeviceState().setOrientation(Orientation.fromDegrees(stateRotationDegrees)).setLandscapeEnabled(isLandscapeEnabled).setDeviceOrientation(Orientation.fromDegrees(orientationDegrees)).build();
}
Also used : CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) Camera(org.thoughtcrime.securesms.ringrtc.Camera) NonNull(androidx.annotation.NonNull)

Aggregations

CallParticipant (org.thoughtcrime.securesms.events.CallParticipant)11 NonNull (androidx.annotation.NonNull)8 RemotePeer (org.thoughtcrime.securesms.ringrtc.RemotePeer)5 CallException (org.signal.ringrtc.CallException)4 ArrayList (java.util.ArrayList)3 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)3 HashSet (java.util.HashSet)2 GroupCall (org.signal.ringrtc.GroupCall)2 CallParticipantId (org.thoughtcrime.securesms.events.CallParticipantId)2 VideoState (org.thoughtcrime.securesms.service.webrtc.state.VideoState)2 WebRtcServiceStateBuilder (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder)2 MainThread (androidx.annotation.MainThread)1 OptionalLong (com.annimon.stream.OptionalLong)1 Map (java.util.Map)1 Recipient (org.thoughtcrime.securesms.recipients.Recipient)1 Camera (org.thoughtcrime.securesms.ringrtc.Camera)1 SingleLiveEvent (org.thoughtcrime.securesms.util.SingleLiveEvent)1 MappingModel (org.thoughtcrime.securesms.util.adapter.mapping.MappingModel)1 VideoTrack (org.webrtc.VideoTrack)1