use of org.thoughtcrime.securesms.ringrtc.Camera in project Signal-Android by signalapp.
the class WebRtcVideoUtil method reinitializeCamera.
@NonNull
public static WebRtcServiceState reinitializeCamera(@NonNull Context context, @NonNull CameraEventListener cameraEventListener, @NonNull WebRtcServiceState currentState) {
final WebRtcServiceStateBuilder builder = currentState.builder();
ThreadUtil.runOnMainSync(() -> {
Camera camera = currentState.getVideoState().requireCamera();
camera.setEnabled(false);
camera.dispose();
camera = new Camera(context, cameraEventListener, currentState.getVideoState().getLockableEglBase(), currentState.getLocalDeviceState().getCameraState().getActiveDirection());
camera.setOrientation(currentState.getLocalDeviceState().getOrientation().getDegrees());
builder.changeVideoState().camera(camera).commit().changeLocalDeviceState().cameraState(camera.getCameraState()).commit();
});
return builder.build();
}
use of org.thoughtcrime.securesms.ringrtc.Camera in project Signal-Android by signalapp.
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();
}
use of org.thoughtcrime.securesms.ringrtc.Camera in project Signal-Android by signalapp.
the class CallSetupActionProcessorDelegate method handleSetEnableVideo.
@Override
@NonNull
protected WebRtcServiceState handleSetEnableVideo(@NonNull WebRtcServiceState currentState, boolean enable) {
Log.i(tag, "handleSetEnableVideo(): enable: " + enable);
Camera camera = currentState.getVideoState().requireCamera();
if (camera.isInitialized()) {
camera.setEnabled(enable);
}
currentState = currentState.builder().changeLocalDeviceState().cameraState(camera.getCameraState()).build();
WebRtcUtil.enableSpeakerPhoneIfNeeded(webRtcInteractor, currentState);
return currentState;
}
use of org.thoughtcrime.securesms.ringrtc.Camera in project Signal-Android by signalapp.
the class GroupJoiningActionProcessor method handleSetEnableVideo.
@Override
@NonNull
protected WebRtcServiceState handleSetEnableVideo(@NonNull WebRtcServiceState currentState, boolean enable) {
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
Camera camera = currentState.getVideoState().requireCamera();
try {
groupCall.setOutgoingVideoMuted(!enable);
} catch (CallException e) {
return groupCallFailure(currentState, "Unable to set video muted", e);
}
camera.setEnabled(enable);
currentState = currentState.builder().changeLocalDeviceState().cameraState(camera.getCameraState()).build();
WebRtcUtil.enableSpeakerPhoneIfNeeded(webRtcInteractor, currentState);
return currentState;
}
Aggregations