Index: webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java |
diff --git a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java |
index e93ce749285912f3406bc2097862f08469fcfa3c..08c024283ce8d6da08d0e9ed25a96078f94e41ea 100644 |
--- a/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java |
+++ b/webrtc/examples/androidtests/src/org/appspot/apprtc/test/PeerConnectionClientTest.java |
@@ -35,7 +35,6 @@ import org.junit.runner.RunWith; |
import org.webrtc.Camera1Enumerator; |
import org.webrtc.Camera2Enumerator; |
import org.webrtc.CameraEnumerator; |
-import org.webrtc.EglBase; |
import org.webrtc.IceCandidate; |
import org.webrtc.MediaCodecVideoEncoder; |
import org.webrtc.PeerConnection; |
@@ -73,9 +72,6 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
private volatile PeerConnectionClient pcClient; |
private volatile boolean loopback; |
- // EGL context that can be used by hardware video decoders to decode to a texture. |
- private EglBase eglBase; |
- |
// These are protected by their respective event objects. |
private ExecutorService signalingExecutor; |
private boolean isClosed; |
@@ -242,22 +238,21 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
PeerConnectionClient createPeerConnectionClient(MockRenderer localRenderer, |
MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParameters, |
- VideoCapturer videoCapturer, EglBase.Context eglContext) { |
+ VideoCapturer videoCapturer) { |
List<PeerConnection.IceServer> iceServers = new LinkedList<PeerConnection.IceServer>(); |
SignalingParameters signalingParameters = |
new SignalingParameters(iceServers, true, // iceServers, initiator. |
null, null, null, // clientId, wssUrl, wssPostUrl. |
null, null); // offerSdp, iceCandidates. |
- PeerConnectionClient client = PeerConnectionClient.getInstance(); |
+ PeerConnectionClient client = new PeerConnectionClient(); |
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); |
options.networkIgnoreMask = 0; |
options.disableNetworkMonitor = true; |
client.setPeerConnectionFactoryOptions(options); |
client.createPeerConnectionFactory( |
InstrumentationRegistry.getTargetContext(), peerConnectionParameters, this); |
- client.createPeerConnection( |
- eglContext, localRenderer, remoteRenderer, videoCapturer, signalingParameters); |
+ client.createPeerConnection(localRenderer, remoteRenderer, videoCapturer, signalingParameters); |
client.createOffer(); |
return client; |
} |
@@ -327,17 +322,11 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
@Before |
public void setUp() { |
signalingExecutor = Executors.newSingleThreadExecutor(); |
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { |
- eglBase = EglBase.create(); |
- } |
} |
@After |
public void tearDown() { |
signalingExecutor.shutdown(); |
- if (eglBase != null) { |
- eglBase.release(); |
- } |
} |
@Test |
@@ -347,7 +336,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME); |
pcClient = createPeerConnectionClient(localRenderer, new MockRenderer(0, null), |
createParametersForVideoCall(VIDEO_CODEC_VP8), |
- createCameraCapturer(false /* captureToTexture */), null); |
+ createCameraCapturer(false /* captureToTexture */)); |
// Wait for local SDP and ice candidates set events. |
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
@@ -375,8 +364,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
} else { |
Log.d(TAG, "testLoopback for audio."); |
} |
- pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, parameters, videoCapturer, |
- decodeToTexture ? eglBase.getEglBaseContext() : null); |
+ pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, parameters, videoCapturer); |
// Wait for local SDP, rename it to answer and set as remote SDP. |
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
@@ -481,50 +469,6 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
createCameraCapturer(true /* captureToTexture */), true /* decodeToTexture */); |
} |
- // Test that a call can be setup even if the EGL context used during initialization is |
- // released before the Video codecs are created. The HW encoder and decoder is setup to use |
- // textures. |
- @Test |
- @SmallTest |
- public void testLoopbackEglContextReleasedAfterCreatingPc() throws InterruptedException { |
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
- Log.i(TAG, "Decode to textures is not supported. Requires SDK version 19"); |
- return; |
- } |
- |
- loopback = true; |
- PeerConnectionParameters parameters = createParametersForVideoCall(VIDEO_CODEC_VP8); |
- MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME); |
- MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME); |
- pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, parameters, |
- createCameraCapturer(true /* captureToTexture */), eglBase.getEglBaseContext()); |
- |
- // Wait for local SDP, rename it to answer and set as remote SDP. |
- assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
- |
- // Release the EGL context used for creating the PeerConnectionClient. |
- // Since createPeerConnectionClient is asynchronous, we must wait for the local |
- // SessionDescription. |
- eglBase.release(); |
- eglBase = null; |
- |
- SessionDescription remoteSdp = new SessionDescription( |
- SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description); |
- pcClient.setRemoteDescription(remoteSdp); |
- |
- // Wait for ICE connection. |
- assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT)); |
- // Check that local and remote video frames were rendered. |
- assertTrue( |
- "Local video frames were not rendered.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT)); |
- assertTrue("Remote video frames were not rendered.", |
- remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT)); |
- |
- pcClient.close(); |
- assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT)); |
- Log.d(TAG, "testLoopback done."); |
- } |
- |
@Test |
@SmallTest |
public void testLoopbackH264CaptureToTexture() throws InterruptedException { |
@@ -555,7 +499,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
createParametersForVideoCall(VIDEO_CODEC_VP8), |
- createCameraCapturer(false /* captureToTexture */), null); |
+ createCameraCapturer(false /* captureToTexture */)); |
// Wait for local SDP, rename it to answer and set as remote SDP. |
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
@@ -603,7 +547,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
createParametersForVideoCall(VIDEO_CODEC_VP8), |
- createCameraCapturer(false /* captureToTexture */), null); |
+ createCameraCapturer(false /* captureToTexture */)); |
// Wait for local SDP, rename it to answer and set as remote SDP. |
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
@@ -652,7 +596,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents { |
pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
createParametersForVideoCall(VIDEO_CODEC_VP8), |
- createCameraCapturer(false /* captureToTexture */), null); |
+ createCameraCapturer(false /* captureToTexture */)); |
// Wait for local SDP, rename it to answer and set as remote SDP. |
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |