Remove unused method 'restartIce'

The method 'restartIce' is dead code since years. So this and related
fields are removed.

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-02-17 15:35:52 +01:00
parent 557602d1bf
commit 890dda0c68
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -85,12 +85,8 @@ public class MagicPeerConnectionWrapper {
private final MediaStream localStream; private final MediaStream localStream;
private final boolean isMCUPublisher; private final boolean isMCUPublisher;
private boolean hasMCU;
private final String videoStreamType; private final String videoStreamType;
private int connectionAttempts = 0;
private PeerConnection.IceConnectionState peerIceConnectionState;
@Inject @Inject
Context context; Context context;
@ -104,7 +100,6 @@ public class MagicPeerConnectionWrapper {
this.localStream = localStream; this.localStream = localStream;
this.videoStreamType = videoStreamType; this.videoStreamType = videoStreamType;
this.hasMCU = hasMCU;
this.sessionId = sessionId; this.sessionId = sessionId;
this.sdpConstraints = sdpConstraints; this.sdpConstraints = sdpConstraints;
@ -332,26 +327,6 @@ public class MagicPeerConnectionWrapper {
} }
} }
private void restartIce() {
if (connectionAttempts <= 5) {
if (!hasMCU || isMCUPublisher) {
MediaConstraints.KeyValuePair iceRestartConstraint =
new MediaConstraints.KeyValuePair("IceRestart", "true");
if (sdpConstraints.mandatory.contains(iceRestartConstraint)) {
sdpConstraints.mandatory.add(iceRestartConstraint);
}
peerConnection.createOffer(magicSdpObserver, sdpConstraints);
} else {
// we have an MCU and this is not the publisher
// Do something if we have an MCU
}
connectionAttempts++;
}
}
private class MagicPeerConnectionObserver implements PeerConnection.Observer { private class MagicPeerConnectionObserver implements PeerConnection.Observer {
@Override @Override
@ -360,13 +335,9 @@ public class MagicPeerConnectionWrapper {
@Override @Override
public void onIceConnectionChange(PeerConnection.IceConnectionState iceConnectionState) { public void onIceConnectionChange(PeerConnection.IceConnectionState iceConnectionState) {
peerIceConnectionState = iceConnectionState;
Log.d("iceConnectionChangeTo: ", iceConnectionState.name() + " over " + peerConnection.hashCode() + " " + sessionId); Log.d("iceConnectionChangeTo: ", iceConnectionState.name() + " over " + peerConnection.hashCode() + " " + sessionId);
if (iceConnectionState.equals(PeerConnection.IceConnectionState.CONNECTED)) { if (iceConnectionState.equals(PeerConnection.IceConnectionState.CONNECTED)) {
connectionAttempts = 0;
/*EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
.PEER_CONNECTED, sessionId, null, null));*/
if (!isMCUPublisher) { if (!isMCUPublisher) {
EventBus.getDefault().post(new MediaStreamEvent(remoteMediaStream, sessionId, videoStreamType)); EventBus.getDefault().post(new MediaStreamEvent(remoteMediaStream, sessionId, videoStreamType));
@ -379,11 +350,7 @@ public class MagicPeerConnectionWrapper {
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.CLOSED)) { } else if (iceConnectionState.equals(PeerConnection.IceConnectionState.CLOSED)) {
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType
.PEER_CLOSED, sessionId, null, null, videoStreamType)); .PEER_CLOSED, sessionId, null, null, videoStreamType));
connectionAttempts = 0;
} else if (iceConnectionState.equals(PeerConnection.IceConnectionState.FAILED)) { } else if (iceConnectionState.equals(PeerConnection.IceConnectionState.FAILED)) {
/*if (MerlinTheWizard.isConnectedToInternet() && connectionAttempts < 5) {
restartIce();
}*/
if (isMCUPublisher) { if (isMCUPublisher) {
EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PUBLISHER_FAILED, sessionId, null, null, null)); EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PUBLISHER_FAILED, sessionId, null, null, null));
} }
@ -491,8 +458,4 @@ public class MagicPeerConnectionWrapper {
} }
} }
} }
public PeerConnection.IceConnectionState getPeerIceConnectionState() {
return peerIceConnectionState;
}
} }