Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1205)

Unified Diff: webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java

Issue 1972793003: Use scoped_refptr for On(Add|Remove)Stream and OnDataChannel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Adding "deprecated" comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java
diff --git a/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java b/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java
index ebeeecd9a9145a4b2f5ded821f639af249c78b9c..c0db18fbe4506f4a13d26ff25294c0e16d06b8d9 100644
--- a/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java
+++ b/webrtc/api/androidtests/src/org/webrtc/PeerConnectionTest.java
@@ -742,9 +742,7 @@ public class PeerConnectionTest extends ActivityTestCase {
answeringExpectations.dataChannel.close();
offeringExpectations.dataChannel.close();
- // Free the Java-land objects, collect them, and sleep a bit to make sure we
- // don't get late-arrival crashes after the Java-land objects have been
- // freed.
+ // Free the Java-land objects and collect them.
shutdownPC(offeringPC, offeringExpectations);
offeringPC = null;
shutdownPC(answeringPC, answeringExpectations);
@@ -955,14 +953,67 @@ public class PeerConnectionTest extends ActivityTestCase {
MediaStream aRMS = answeringExpectations.gotRemoteStreams.iterator().next();
assertEquals(aRMS.videoTracks.get(0).state(), MediaStreamTrack.State.ENDED);
- // Free the Java-land objects, collect them, and sleep a bit to make sure we
- // don't get late-arrival crashes after the Java-land objects have been
- // freed.
+ // Finally, remove the audio track as well, which should completely remove
+ // the remote stream. This used to trigger an assert.
+ // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=5128
+ AudioTrack offererAudioTrack = oLMS.get().audioTracks.get(0);
+ oLMS.get().removeTrack(offererAudioTrack);
+
+ // Create offer.
+ sdpLatch = new SdpObserverLatch();
+ offeringPC.createOffer(sdpLatch, new MediaConstraints());
+ assertTrue(sdpLatch.await());
+ offerSdp = sdpLatch.getSdp();
+ assertEquals(offerSdp.type, SessionDescription.Type.OFFER);
+ assertFalse(offerSdp.description.isEmpty());
+
+ // Set local description for offerer.
+ sdpLatch = new SdpObserverLatch();
+ offeringExpectations.expectSignalingChange(SignalingState.HAVE_LOCAL_OFFER);
+ offeringPC.setLocalDescription(sdpLatch, offerSdp);
+ assertTrue(sdpLatch.await());
+ assertNull(sdpLatch.getSdp());
+
+ // Set remote description for answerer.
+ sdpLatch = new SdpObserverLatch();
+ answeringExpectations.expectSignalingChange(SignalingState.HAVE_REMOTE_OFFER);
+ answeringExpectations.expectRemoveStream("offeredMediaStream");
+ answeringPC.setRemoteDescription(sdpLatch, offerSdp);
+ assertTrue(sdpLatch.await());
+ assertNull(sdpLatch.getSdp());
+
+ // Create answer.
+ sdpLatch = new SdpObserverLatch();
+ answeringPC.createAnswer(sdpLatch, new MediaConstraints());
+ assertTrue(sdpLatch.await());
+ answerSdp = sdpLatch.getSdp();
+ assertEquals(answerSdp.type, SessionDescription.Type.ANSWER);
+ assertFalse(answerSdp.description.isEmpty());
+
+ // Set local description for answerer.
+ sdpLatch = new SdpObserverLatch();
+ answeringExpectations.expectSignalingChange(SignalingState.STABLE);
+ answeringPC.setLocalDescription(sdpLatch, answerSdp);
+ assertTrue(sdpLatch.await());
+ assertNull(sdpLatch.getSdp());
+
+ // Set remote description for offerer.
+ sdpLatch = new SdpObserverLatch();
+ offeringExpectations.expectSignalingChange(SignalingState.STABLE);
+ offeringPC.setRemoteDescription(sdpLatch, answerSdp);
+ assertTrue(sdpLatch.await());
+ assertNull(sdpLatch.getSdp());
+
+ // Make sure the stream was really removed.
+ assertTrue(answeringExpectations.gotRemoteStreams.isEmpty());
+
+ // Free the Java-land objects and collect them.
shutdownPC(offeringPC, offeringExpectations);
offeringPC = null;
shutdownPC(answeringPC, answeringExpectations);
answeringPC = null;
offererVideoTrack.dispose();
+ offererAudioTrack.dispose();
videoSource.dispose();
factory.dispose();
System.gc();
« no previous file with comments | « no previous file | webrtc/api/java/jni/peerconnection_jni.cc » ('j') | webrtc/examples/peerconnection/client/conductor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698