Implement 1:1 call mutes state.

This commit is contained in:
Alex Hart
2025-02-05 14:22:09 -04:00
committed by Greyson Parrelli
parent 23ad23c341
commit e840efcecc
7 changed files with 41 additions and 4 deletions

View File

@@ -67,6 +67,10 @@ data class CallParticipant(
return copy(identityKey = identityKey)
}
fun withAudioEnabled(audioEnabled: Boolean): CallParticipant {
return copy(isMicrophoneEnabled = audioEnabled)
}
fun withVideoEnabled(videoEnabled: Boolean): CallParticipant {
return copy(isVideoEnabled = videoEnabled)
}

View File

@@ -56,6 +56,21 @@ public class ActiveCallActionProcessorDelegate extends WebRtcActionProcessor {
return currentState;
}
@Override
protected @NonNull WebRtcServiceState handleRemoteAudioEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();
Log.i(tag, "handleRemoteAudioEnable(): call_id: " + activePeer.getCallId());
CallParticipant oldParticipant = Objects.requireNonNull(currentState.getCallInfoState().getRemoteCallParticipant(activePeer.getRecipient()));
CallParticipant newParticipant = oldParticipant.withAudioEnabled(enable);
return currentState.builder()
.changeCallInfoState()
.putParticipant(activePeer.getRecipient(), newParticipant)
.build();
}
@Override
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
RemotePeer activePeer = currentState.getCallInfoState().requireActivePeer();

View File

@@ -110,6 +110,11 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
.build();
}
@Override
protected @NonNull WebRtcServiceState handleRemoteAudioEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteAudioEnable(currentState, enable);
}
@Override
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);

View File

@@ -232,6 +232,11 @@ public class IncomingCallActionProcessor extends DeviceAwareActionProcessor {
return currentState;
}
@Override
protected @NonNull WebRtcServiceState handleRemoteAudioEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteAudioEnable(currentState, enable);
}
@Override
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);

View File

@@ -233,6 +233,11 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
.build();
}
@Override
protected @NonNull WebRtcServiceState handleRemoteAudioEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteAudioEnable(currentState, enable);
}
@Override
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);

View File

@@ -616,11 +616,9 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
case REMOTE_CONNECTED:
return p.handleCallConnected(s, remotePeer);
case REMOTE_AUDIO_ENABLE:
// TODO: Implement handling when the remote enables audio.
break;
return p.handleRemoteAudioEnable(s, true);
case REMOTE_AUDIO_DISABLE:
// TODO: Implement handling when the remote disables audio.
break;
return p.handleRemoteAudioEnable(s, false);
case REMOTE_VIDEO_ENABLE:
return p.handleRemoteVideoEnable(s, true);
case REMOTE_VIDEO_DISABLE:

View File

@@ -375,6 +375,11 @@ public abstract class WebRtcActionProcessor {
.build();
}
protected @NonNull WebRtcServiceState handleRemoteAudioEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
Log.i(tag, "handleRemoteAudioEnable not processed");
return currentState;
}
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
Log.i(tag, "handleRemoteVideoEnable not processed");
return currentState;