mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Fix RuntimeException during call initialization.
This commit is contained in:
@@ -45,7 +45,7 @@ public class BeginCallActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
CallParticipant.createRemote(new CallParticipantId(remotePeer.getRecipient()),
|
||||
remotePeer.getRecipient(),
|
||||
null,
|
||||
new BroadcastVideoSink(currentState.getVideoState().getEglBase(),
|
||||
new BroadcastVideoSink(currentState.getVideoState().getLockableEglBase(),
|
||||
false,
|
||||
true,
|
||||
currentState.getLocalDeviceState().getOrientation().getDegrees()),
|
||||
@@ -92,7 +92,7 @@ public class BeginCallActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
CallParticipant.createRemote(new CallParticipantId(remotePeer.getRecipient()),
|
||||
remotePeer.getRecipient(),
|
||||
null,
|
||||
new BroadcastVideoSink(currentState.getVideoState().getEglBase(),
|
||||
new BroadcastVideoSink(currentState.getVideoState().getLockableEglBase(),
|
||||
false,
|
||||
true,
|
||||
currentState.getLocalDeviceState().getOrientation().getDegrees()),
|
||||
|
||||
@@ -92,11 +92,11 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
|
||||
BroadcastVideoSink videoSink;
|
||||
VideoTrack videoTrack = device.getVideoTrack();
|
||||
if (videoTrack != null) {
|
||||
videoSink = (callParticipant != null && callParticipant.getVideoSink().getEglBase() != null) ? callParticipant.getVideoSink()
|
||||
: new BroadcastVideoSink(currentState.getVideoState().requireEglBase(),
|
||||
true,
|
||||
true,
|
||||
currentState.getLocalDeviceState().getOrientation().getDegrees());
|
||||
videoSink = (callParticipant != null && callParticipant.getVideoSink().getLockableEglBase().getEglBase() != null) ? callParticipant.getVideoSink()
|
||||
: new BroadcastVideoSink(currentState.getVideoState().getLockableEglBase(),
|
||||
true,
|
||||
true,
|
||||
currentState.getLocalDeviceState().getOrientation().getDegrees());
|
||||
videoTrack.addSink(videoSink);
|
||||
} else {
|
||||
videoSink = new BroadcastVideoSink();
|
||||
@@ -267,7 +267,7 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
|
||||
currentState = terminateGroupCall(currentState, false).builder()
|
||||
.actionProcessor(new GroupNetworkUnavailableActionProcessor(webRtcInteractor))
|
||||
.changeVideoState()
|
||||
.eglBase(videoState.getEglBase())
|
||||
.eglBase(videoState.getLockableEglBase())
|
||||
.camera(videoState.getCamera())
|
||||
.localSink(videoState.getLocalSink())
|
||||
.commit()
|
||||
|
||||
@@ -44,7 +44,7 @@ class GroupNetworkUnavailableActionProcessor extends WebRtcActionProcessor {
|
||||
byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId();
|
||||
GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId,
|
||||
SignalStore.internalValues().groupCallingServer(),
|
||||
currentState.getVideoState().requireEglBase(),
|
||||
currentState.getVideoState().getLockableEglBase().require(),
|
||||
webRtcInteractor.getGroupCallObserver());
|
||||
|
||||
return currentState.builder()
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
byte[] groupId = currentState.getCallInfoState().getCallRecipient().requireGroupId().getDecodedId();
|
||||
GroupCall groupCall = webRtcInteractor.getCallManager().createGroupCall(groupId,
|
||||
SignalStore.internalValues().groupCallingServer(),
|
||||
currentState.getVideoState().requireEglBase(),
|
||||
currentState.getVideoState().getLockableEglBase().require(),
|
||||
webRtcInteractor.getGroupCallObserver());
|
||||
|
||||
try {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class IncomingCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
try {
|
||||
webRtcInteractor.getCallManager().proceed(activePeer.getCallId(),
|
||||
context,
|
||||
videoState.requireEglBase(),
|
||||
videoState.getLockableEglBase().require(),
|
||||
videoState.requireLocalSink(),
|
||||
callParticipant.getVideoSink(),
|
||||
videoState.requireCamera(),
|
||||
|
||||
@@ -118,7 +118,7 @@ public class OutgoingCallActionProcessor extends DeviceAwareActionProcessor {
|
||||
|
||||
webRtcInteractor.getCallManager().proceed(activePeer.getCallId(),
|
||||
context,
|
||||
videoState.requireEglBase(),
|
||||
videoState.getLockableEglBase().require(),
|
||||
videoState.requireLocalSink(),
|
||||
callParticipant.getVideoSink(),
|
||||
videoState.requireCamera(),
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.core.util.ThreadUtil;
|
||||
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink;
|
||||
import org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper;
|
||||
import org.thoughtcrime.securesms.ringrtc.Camera;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraEventListener;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState;
|
||||
@@ -31,7 +32,7 @@ public final class WebRtcVideoUtil {
|
||||
final WebRtcServiceStateBuilder builder = currentState.builder();
|
||||
|
||||
ThreadUtil.runOnMainSync(() -> {
|
||||
EglBase eglBase = EglBase.create();
|
||||
EglBaseWrapper eglBase = new EglBaseWrapper(EglBase.create());
|
||||
BroadcastVideoSink localSink = new BroadcastVideoSink(eglBase,
|
||||
true,
|
||||
false,
|
||||
@@ -66,7 +67,7 @@ public final class WebRtcVideoUtil {
|
||||
|
||||
camera = new Camera(context,
|
||||
cameraEventListener,
|
||||
currentState.getVideoState().requireEglBase(),
|
||||
currentState.getVideoState().getLockableEglBase(),
|
||||
currentState.getLocalDeviceState().getCameraState().getActiveDirection());
|
||||
|
||||
camera.setOrientation(currentState.getLocalDeviceState().getOrientation().getDegrees());
|
||||
@@ -88,10 +89,7 @@ public final class WebRtcVideoUtil {
|
||||
camera.dispose();
|
||||
}
|
||||
|
||||
EglBase eglBase = currentState.getVideoState().getEglBase();
|
||||
if (eglBase != null) {
|
||||
eglBase.release();
|
||||
}
|
||||
currentState.getVideoState().getLockableEglBase().releaseEglBase();
|
||||
|
||||
return currentState.builder()
|
||||
.changeVideoState()
|
||||
|
||||
@@ -4,8 +4,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink;
|
||||
import org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper;
|
||||
import org.thoughtcrime.securesms.ringrtc.Camera;
|
||||
import org.webrtc.EglBase;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.Objects;
|
||||
* Local device video state and infrastructure.
|
||||
*/
|
||||
public final class VideoState {
|
||||
EglBase eglBase;
|
||||
EglBaseWrapper eglBase;
|
||||
BroadcastVideoSink localSink;
|
||||
Camera camera;
|
||||
|
||||
@@ -25,20 +25,16 @@ public final class VideoState {
|
||||
this(toCopy.eglBase, toCopy.localSink, toCopy.camera);
|
||||
}
|
||||
|
||||
VideoState(@Nullable EglBase eglBase, @Nullable BroadcastVideoSink localSink, @Nullable Camera camera) {
|
||||
VideoState(@NonNull EglBaseWrapper eglBase, @Nullable BroadcastVideoSink localSink, @Nullable Camera camera) {
|
||||
this.eglBase = eglBase;
|
||||
this.localSink = localSink;
|
||||
this.camera = camera;
|
||||
}
|
||||
|
||||
public @Nullable EglBase getEglBase() {
|
||||
public @NonNull EglBaseWrapper getLockableEglBase() {
|
||||
return eglBase;
|
||||
}
|
||||
|
||||
public @NonNull EglBase requireEglBase() {
|
||||
return Objects.requireNonNull(eglBase);
|
||||
}
|
||||
|
||||
public @Nullable BroadcastVideoSink getLocalSink() {
|
||||
return localSink;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.annimon.stream.OptionalLong;
|
||||
import org.signal.ringrtc.GroupCall;
|
||||
import org.thoughtcrime.securesms.components.sensors.Orientation;
|
||||
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink;
|
||||
import org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper;
|
||||
import org.thoughtcrime.securesms.events.CallParticipant;
|
||||
import org.thoughtcrime.securesms.events.CallParticipantId;
|
||||
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
||||
@@ -17,7 +18,6 @@ import org.thoughtcrime.securesms.ringrtc.Camera;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState;
|
||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||
import org.thoughtcrime.securesms.service.webrtc.WebRtcActionProcessor;
|
||||
import org.webrtc.EglBase;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -177,7 +177,7 @@ public class WebRtcServiceStateBuilder {
|
||||
return WebRtcServiceStateBuilder.this.build();
|
||||
}
|
||||
|
||||
public @NonNull VideoStateBuilder eglBase(@Nullable EglBase eglBase) {
|
||||
public @NonNull VideoStateBuilder eglBase(@Nullable EglBaseWrapper eglBase) {
|
||||
toBuild.eglBase = eglBase;
|
||||
return this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user