Search in sources :

Example 1 with WebRtcServiceState

use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by WhisperSystems.

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 2 with WebRtcServiceState

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));
}
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 3 with WebRtcServiceState

use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState 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 4 with WebRtcServiceState

use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState 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 5 with WebRtcServiceState

use of org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState in project Signal-Android by signalapp.

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;
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) SignalAudioManager(org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager) RingUpdate(org.signal.ringrtc.CallManager.RingUpdate) NonNull(androidx.annotation.NonNull) RecipientUtil(org.thoughtcrime.securesms.recipients.RecipientUtil) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) CallException(org.signal.ringrtc.CallException) CallManager(org.signal.ringrtc.CallManager) RecipientId(org.thoughtcrime.securesms.recipients.RecipientId) NotificationProfiles(org.thoughtcrime.securesms.notifications.profiles.NotificationProfiles) NetworkUtil(org.thoughtcrime.securesms.util.NetworkUtil) Recipient(org.thoughtcrime.securesms.recipients.Recipient) BusyMessage(org.whispersystems.signalservice.api.messages.calls.BusyMessage) IdentityKeyUtil(org.thoughtcrime.securesms.crypto.IdentityKeyUtil) ApplicationDependencies(org.thoughtcrime.securesms.dependencies.ApplicationDependencies) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) NotificationProfile(org.thoughtcrime.securesms.notifications.profiles.NotificationProfile) IdentityKey(org.whispersystems.libsignal.IdentityKey) GroupCall(org.signal.ringrtc.GroupCall) Objects(java.util.Objects) Log(org.signal.core.util.logging.Log) List(java.util.List) Nullable(androidx.annotation.Nullable) CallState(org.thoughtcrime.securesms.ringrtc.CallState) OfferMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.OfferMetadata) GroupId(org.thoughtcrime.securesms.groups.GroupId) CallId(org.signal.ringrtc.CallId) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) AnswerMessage(org.whispersystems.signalservice.api.messages.calls.AnswerMessage) CallMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.CallMetadata) Context(android.content.Context) SignalDatabase(org.thoughtcrime.securesms.database.SignalDatabase) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) Stream(com.annimon.stream.Stream) ReceivedOfferMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.ReceivedOfferMetadata) InvalidKeyException(org.whispersystems.libsignal.InvalidKeyException) OfferMessage(org.whispersystems.signalservice.api.messages.calls.OfferMessage) EglBaseWrapper(org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper) GroupCallSafetyNumberChangeNotificationUtil(org.thoughtcrime.securesms.components.webrtc.GroupCallSafetyNumberChangeNotificationUtil) LockManager(org.thoughtcrime.securesms.webrtc.locks.LockManager) CameraState(org.thoughtcrime.securesms.ringrtc.CameraState) HangupMessage(org.whispersystems.signalservice.api.messages.calls.HangupMessage) SignalServiceCallMessage(org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage) Camera(org.thoughtcrime.securesms.ringrtc.Camera) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) PeerConnection(org.webrtc.PeerConnection) WebRtcViewModel(org.thoughtcrime.securesms.events.WebRtcViewModel) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) Orientation(org.thoughtcrime.securesms.components.sensors.Orientation) TelephonyUtil(org.thoughtcrime.securesms.util.TelephonyUtil) Optional(org.whispersystems.libsignal.util.guava.Optional) AnswerMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.AnswerMetadata) IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) HangupMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.HangupMetadata) ResultReceiver(android.os.ResultReceiver) ReceivedAnswerMetadata(org.thoughtcrime.securesms.service.webrtc.WebRtcData.ReceivedAnswerMetadata) IceUpdateMessage(org.whispersystems.signalservice.api.messages.calls.IceUpdateMessage) SignalServiceCallMessage(org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage) NonNull(androidx.annotation.NonNull)

Aggregations

CallException (org.signal.ringrtc.CallException)12 WebRtcServiceState (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState)12 NonNull (androidx.annotation.NonNull)10 GroupCall (org.signal.ringrtc.GroupCall)10 Stream (com.annimon.stream.Stream)8 List (java.util.List)8 Log (org.signal.core.util.logging.Log)8 WebRtcViewModel (org.thoughtcrime.securesms.events.WebRtcViewModel)8 Recipient (org.thoughtcrime.securesms.recipients.Recipient)8 RemotePeer (org.thoughtcrime.securesms.ringrtc.RemotePeer)8 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)6 CallParticipant (org.thoughtcrime.securesms.events.CallParticipant)6 WebRtcServiceStateBuilder (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder)6 OfferMessage (org.whispersystems.signalservice.api.messages.calls.OfferMessage)6 ResultReceiver (android.os.ResultReceiver)4 Nullable (androidx.annotation.Nullable)4 ArrayList (java.util.ArrayList)4 Collection (java.util.Collection)4 Set (java.util.Set)4 UUID (java.util.UUID)4