use implicit rollback (needed to be enabled on libwebrtc)

This commit is contained in:
Daniel Gultsch 2021-11-16 13:17:10 +01:00
parent 0698fa0d8c
commit 297a843b9c
2 changed files with 1 additions and 27 deletions

View File

@ -356,8 +356,6 @@ public class JingleRtpConnection extends AbstractJingleConnection implements Web
//We ignore the offer and respond with tie-break. This will clause the responder not to apply the content map //We ignore the offer and respond with tie-break. This will clause the responder not to apply the content map
return false; return false;
} }
//rollback our own local description. should happen automatically but doesn't
webRTCWrapper.rollbackLocalDescription().get();
} }
webRTCWrapper.setRemoteDescription(sdp).get(); webRTCWrapper.setRemoteDescription(sdp).get();
setRemoteContentMap(restartContentMap); setRemoteContentMap(restartContentMap);

View File

@ -86,7 +86,6 @@ public class WebRTCWrapper {
private final EventCallback eventCallback; private final EventCallback eventCallback;
private final AtomicBoolean readyToReceivedIceCandidates = new AtomicBoolean(false); private final AtomicBoolean readyToReceivedIceCandidates = new AtomicBoolean(false);
private final AtomicBoolean ignoreOnRenegotiationNeeded = new AtomicBoolean(false);
private final Queue<IceCandidate> iceCandidates = new LinkedList<>(); private final Queue<IceCandidate> iceCandidates = new LinkedList<>();
private final AppRTCAudioManager.AudioManagerEvents audioManagerEvents = new AppRTCAudioManager.AudioManagerEvents() { private final AppRTCAudioManager.AudioManagerEvents audioManagerEvents = new AppRTCAudioManager.AudioManagerEvents() {
@Override @Override
@ -163,10 +162,6 @@ public class WebRTCWrapper {
@Override @Override
public void onRenegotiationNeeded() { public void onRenegotiationNeeded() {
if (ignoreOnRenegotiationNeeded.get()) {
Log.d(EXTENDED_LOGGING_TAG, "ignoring onRenegotiationNeeded()");
return;
}
Log.d(EXTENDED_LOGGING_TAG, "onRenegotiationNeeded()"); Log.d(EXTENDED_LOGGING_TAG, "onRenegotiationNeeded()");
final PeerConnection.PeerConnectionState currentState = peerConnection == null ? null : peerConnection.connectionState(); final PeerConnection.PeerConnectionState currentState = peerConnection == null ? null : peerConnection.connectionState();
if (currentState != null && currentState != PeerConnection.PeerConnectionState.NEW) { if (currentState != null && currentState != PeerConnection.PeerConnectionState.NEW) {
@ -277,6 +272,7 @@ public class WebRTCWrapper {
rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY; rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN; rtcConfig.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.NEGOTIATE; rtcConfig.rtcpMuxPolicy = PeerConnection.RtcpMuxPolicy.NEGOTIATE;
rtcConfig.enableImplicitRollback = true;
final PeerConnection peerConnection = peerConnectionFactory.createPeerConnection(rtcConfig, peerConnectionObserver); final PeerConnection peerConnection = peerConnectionFactory.createPeerConnection(rtcConfig, peerConnectionObserver);
if (peerConnection == null) { if (peerConnection == null) {
throw new InitializationException("Unable to create PeerConnection"); throw new InitializationException("Unable to create PeerConnection");
@ -456,26 +452,6 @@ public class WebRTCWrapper {
}, MoreExecutors.directExecutor()); }, MoreExecutors.directExecutor());
} }
public ListenableFuture<Void> rollbackLocalDescription() {
final SettableFuture<Void> future = SettableFuture.create();
final SessionDescription rollback = new SessionDescription(SessionDescription.Type.ROLLBACK, "");
ignoreOnRenegotiationNeeded.set(true);
requirePeerConnection().setLocalDescription(new SetSdpObserver() {
@Override
public void onSetSuccess() {
future.set(null);
ignoreOnRenegotiationNeeded.set(false);
}
@Override
public void onSetFailure(final String message) {
future.setException(new FailureToSetDescriptionException(message));
}
}, rollback);
return future;
}
private static void logDescription(final SessionDescription sessionDescription) { private static void logDescription(final SessionDescription sessionDescription) {
for (final String line : sessionDescription.description.split(eu.siacs.conversations.xmpp.jingle.SessionDescription.LINE_DIVIDER)) { for (final String line : sessionDescription.description.split(eu.siacs.conversations.xmpp.jingle.SessionDescription.LINE_DIVIDER)) {
Log.d(EXTENDED_LOGGING_TAG, line); Log.d(EXTENDED_LOGGING_TAG, line);