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}
This commit is contained in:
Philipp Hancke
2020-09-21 20:12:08 +02:00
committed by Commit Bot
parent df2a4654a0
commit 79d8df021c
2 changed files with 34 additions and 1 deletions

View File

@ -22,7 +22,8 @@ public class SessionDescription {
public static enum Type {
OFFER,
PRANSWER,
ANSWER;
ANSWER,
ROLLBACK;
public String canonicalForm() {
return name().toLowerCase(Locale.US);

View File

@ -1488,6 +1488,38 @@ public class PeerConnectionEndToEndTest {
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) {