android: add rollback RTCSdpType
BUG=webrtc:11796,webrtc:11970
Change-Id: I0047c7a050c344ef58735d9d0d6534b1ddf6c4d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184263
Reviewed-by: Taylor <deadbeef@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#32243}
diff --git a/sdk/android/api/org/webrtc/SessionDescription.java b/sdk/android/api/org/webrtc/SessionDescription.java
index 62601f0..be89599 100644
--- a/sdk/android/api/org/webrtc/SessionDescription.java
+++ b/sdk/android/api/org/webrtc/SessionDescription.java
@@ -22,7 +22,8 @@
public static enum Type {
OFFER,
PRANSWER,
- ANSWER;
+ ANSWER,
+ ROLLBACK;
public String canonicalForm() {
return name().toLowerCase(Locale.US);
diff --git a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionEndToEndTest.java b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionEndToEndTest.java
index 88be833..c380310 100644
--- a/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionEndToEndTest.java
+++ b/sdk/android/instrumentationtests/src/org/webrtc/PeerConnectionEndToEndTest.java
@@ -1488,6 +1488,38 @@
factory.dispose();
}
+ @Test
+ @SmallTest
+ public void testRollback() throws Exception {
+ PeerConnectionFactory factory = PeerConnectionFactory.builder().createPeerConnectionFactory();
+ PeerConnection.RTCConfiguration config = new PeerConnection.RTCConfiguration(Arrays.asList());
+ config.sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN;
+
+ ObserverExpectations offeringExpectations = new ObserverExpectations("PCTest:offerer");
+ PeerConnection pc = factory.createPeerConnection(config, offeringExpectations);
+
+ SdpObserverLatch sdpLatch = new SdpObserverLatch();
+ pc.createOffer(sdpLatch, new MediaConstraints());
+ assertTrue(sdpLatch.await());
+ SessionDescription offer = sdpLatch.getSdp();
+
+ sdpLatch = new SdpObserverLatch();
+ offeringExpectations.expectSignalingChange(SignalingState.HAVE_LOCAL_OFFER);
+ pc.setLocalDescription(sdpLatch, offer);
+ assertTrue(sdpLatch.await());
+
+ SessionDescription rollback = new SessionDescription(SessionDescription.Type.ROLLBACK, "");
+ sdpLatch = new SdpObserverLatch();
+ offeringExpectations.expectSignalingChange(SignalingState.STABLE);
+ // TODO(bugs.webrtc.org/11970): determine if triggering ONN (twice even) is correct.
+ offeringExpectations.expectRenegotiationNeeded();
+ offeringExpectations.expectRenegotiationNeeded();
+ pc.setLocalDescription(sdpLatch, rollback);
+ assertTrue(sdpLatch.await());
+
+ assertTrue(offeringExpectations.waitForAllExpectationsToBeSatisfied(DEFAULT_TIMEOUT_SECONDS));
+ }
+
private static void negotiate(PeerConnection offeringPC,
ObserverExpectations offeringExpectations, PeerConnection answeringPC,
ObserverExpectations answeringExpectations) {