Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
android: add rollback RTCSdpType
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
fippo authored and Commit Bot committed Sep 30, 2020
1 parent df2a465 commit 79d8df0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sdk/android/api/org/webrtc/SessionDescription.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class SessionDescription {
public static enum Type {
OFFER,
PRANSWER,
ANSWER;
ANSWER,
ROLLBACK;

public String canonicalForm() {
return name().toLowerCase(Locale.US);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,38 @@ public void testRemoteStreamUpdatedWhenTracksAddedOrRemoved() throws Exception {
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) {
Expand Down

0 comments on commit 79d8df0

Please sign in to comment.