| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionEvents; | 28 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionEvents; |
| 29 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; | 29 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; |
| 30 import org.chromium.base.test.BaseJUnit4ClassRunner; | 30 import org.chromium.base.test.BaseJUnit4ClassRunner; |
| 31 import org.junit.After; | 31 import org.junit.After; |
| 32 import org.junit.Before; | 32 import org.junit.Before; |
| 33 import org.junit.Test; | 33 import org.junit.Test; |
| 34 import org.junit.runner.RunWith; | 34 import org.junit.runner.RunWith; |
| 35 import org.webrtc.Camera1Enumerator; | 35 import org.webrtc.Camera1Enumerator; |
| 36 import org.webrtc.Camera2Enumerator; | 36 import org.webrtc.Camera2Enumerator; |
| 37 import org.webrtc.CameraEnumerator; | 37 import org.webrtc.CameraEnumerator; |
| 38 import org.webrtc.EglBase; | |
| 39 import org.webrtc.IceCandidate; | 38 import org.webrtc.IceCandidate; |
| 40 import org.webrtc.MediaCodecVideoEncoder; | 39 import org.webrtc.MediaCodecVideoEncoder; |
| 41 import org.webrtc.PeerConnection; | 40 import org.webrtc.PeerConnection; |
| 42 import org.webrtc.PeerConnectionFactory; | 41 import org.webrtc.PeerConnectionFactory; |
| 43 import org.webrtc.SessionDescription; | 42 import org.webrtc.SessionDescription; |
| 44 import org.webrtc.StatsReport; | 43 import org.webrtc.StatsReport; |
| 45 import org.webrtc.VideoCapturer; | 44 import org.webrtc.VideoCapturer; |
| 46 import org.webrtc.VideoRenderer; | 45 import org.webrtc.VideoRenderer; |
| 47 | 46 |
| 48 @RunWith(BaseJUnit4ClassRunner.class) | 47 @RunWith(BaseJUnit4ClassRunner.class) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 private static final int WIDTH_VGA = 640; | 65 private static final int WIDTH_VGA = 640; |
| 67 private static final int HEIGHT_VGA = 480; | 66 private static final int HEIGHT_VGA = 480; |
| 68 private static final int WIDTH_QVGA = 320; | 67 private static final int WIDTH_QVGA = 320; |
| 69 private static final int HEIGHT_QVGA = 240; | 68 private static final int HEIGHT_QVGA = 240; |
| 70 | 69 |
| 71 // The peer connection client is assumed to be thread safe in itself; the | 70 // The peer connection client is assumed to be thread safe in itself; the |
| 72 // reference is written by the test thread and read by worker threads. | 71 // reference is written by the test thread and read by worker threads. |
| 73 private volatile PeerConnectionClient pcClient; | 72 private volatile PeerConnectionClient pcClient; |
| 74 private volatile boolean loopback; | 73 private volatile boolean loopback; |
| 75 | 74 |
| 76 // EGL context that can be used by hardware video decoders to decode to a text
ure. | |
| 77 private EglBase eglBase; | |
| 78 | |
| 79 // These are protected by their respective event objects. | 75 // These are protected by their respective event objects. |
| 80 private ExecutorService signalingExecutor; | 76 private ExecutorService signalingExecutor; |
| 81 private boolean isClosed; | 77 private boolean isClosed; |
| 82 private boolean isIceConnected; | 78 private boolean isIceConnected; |
| 83 private SessionDescription localSdp; | 79 private SessionDescription localSdp; |
| 84 private List<IceCandidate> iceCandidates = new LinkedList<IceCandidate>(); | 80 private List<IceCandidate> iceCandidates = new LinkedList<IceCandidate>(); |
| 85 private final Object localSdpEvent = new Object(); | 81 private final Object localSdpEvent = new Object(); |
| 86 private final Object iceCandidateEvent = new Object(); | 82 private final Object iceCandidateEvent = new Object(); |
| 87 private final Object iceConnectedEvent = new Object(); | 83 private final Object iceConnectedEvent = new Object(); |
| 88 private final Object closeEvent = new Object(); | 84 private final Object closeEvent = new Object(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 synchronized (closeEvent) { | 231 synchronized (closeEvent) { |
| 236 if (!isClosed) { | 232 if (!isClosed) { |
| 237 closeEvent.wait(timeoutMs); | 233 closeEvent.wait(timeoutMs); |
| 238 } | 234 } |
| 239 return isClosed; | 235 return isClosed; |
| 240 } | 236 } |
| 241 } | 237 } |
| 242 | 238 |
| 243 PeerConnectionClient createPeerConnectionClient(MockRenderer localRenderer, | 239 PeerConnectionClient createPeerConnectionClient(MockRenderer localRenderer, |
| 244 MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParame
ters, | 240 MockRenderer remoteRenderer, PeerConnectionParameters peerConnectionParame
ters, |
| 245 VideoCapturer videoCapturer, EglBase.Context eglContext) { | 241 VideoCapturer videoCapturer) { |
| 246 List<PeerConnection.IceServer> iceServers = new LinkedList<PeerConnection.Ic
eServer>(); | 242 List<PeerConnection.IceServer> iceServers = new LinkedList<PeerConnection.Ic
eServer>(); |
| 247 SignalingParameters signalingParameters = | 243 SignalingParameters signalingParameters = |
| 248 new SignalingParameters(iceServers, true, // iceServers, initiator. | 244 new SignalingParameters(iceServers, true, // iceServers, initiator. |
| 249 null, null, null, // clientId, wssUrl, wssPostUrl. | 245 null, null, null, // clientId, wssUrl, wssPostUrl. |
| 250 null, null); // offerSdp, iceCandidates. | 246 null, null); // offerSdp, iceCandidates. |
| 251 | 247 |
| 252 PeerConnectionClient client = PeerConnectionClient.getInstance(); | 248 PeerConnectionClient client = new PeerConnectionClient(); |
| 253 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); | 249 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); |
| 254 options.networkIgnoreMask = 0; | 250 options.networkIgnoreMask = 0; |
| 255 options.disableNetworkMonitor = true; | 251 options.disableNetworkMonitor = true; |
| 256 client.setPeerConnectionFactoryOptions(options); | 252 client.setPeerConnectionFactoryOptions(options); |
| 257 client.createPeerConnectionFactory( | 253 client.createPeerConnectionFactory( |
| 258 InstrumentationRegistry.getTargetContext(), peerConnectionParameters, th
is); | 254 InstrumentationRegistry.getTargetContext(), peerConnectionParameters, th
is); |
| 259 client.createPeerConnection( | 255 client.createPeerConnection(localRenderer, remoteRenderer, videoCapturer, si
gnalingParameters); |
| 260 eglContext, localRenderer, remoteRenderer, videoCapturer, signalingParam
eters); | |
| 261 client.createOffer(); | 256 client.createOffer(); |
| 262 return client; | 257 return client; |
| 263 } | 258 } |
| 264 | 259 |
| 265 private PeerConnectionParameters createParametersForAudioCall() { | 260 private PeerConnectionParameters createParametersForAudioCall() { |
| 266 PeerConnectionParameters peerConnectionParameters = new PeerConnectionParame
ters( | 261 PeerConnectionParameters peerConnectionParameters = new PeerConnectionParame
ters( |
| 267 false, /* videoCallEnabled */ | 262 false, /* videoCallEnabled */ |
| 268 true, /* loopback */ | 263 true, /* loopback */ |
| 269 false, /* tracing */ | 264 false, /* tracing */ |
| 270 // Video codec parameters. | 265 // Video codec parameters. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 false, /* aecDump */ | 315 false, /* aecDump */ |
| 321 false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disable
BuiltInAGC */, | 316 false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disable
BuiltInAGC */, |
| 322 false /* disableBuiltInNS */, false /* enableLevelControl */, false /* d
isableWebRtcAGC */); | 317 false /* disableBuiltInNS */, false /* enableLevelControl */, false /* d
isableWebRtcAGC */); |
| 323 | 318 |
| 324 return peerConnectionParameters; | 319 return peerConnectionParameters; |
| 325 } | 320 } |
| 326 | 321 |
| 327 @Before | 322 @Before |
| 328 public void setUp() { | 323 public void setUp() { |
| 329 signalingExecutor = Executors.newSingleThreadExecutor(); | 324 signalingExecutor = Executors.newSingleThreadExecutor(); |
| 330 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { | |
| 331 eglBase = EglBase.create(); | |
| 332 } | |
| 333 } | 325 } |
| 334 | 326 |
| 335 @After | 327 @After |
| 336 public void tearDown() { | 328 public void tearDown() { |
| 337 signalingExecutor.shutdown(); | 329 signalingExecutor.shutdown(); |
| 338 if (eglBase != null) { | |
| 339 eglBase.release(); | |
| 340 } | |
| 341 } | 330 } |
| 342 | 331 |
| 343 @Test | 332 @Test |
| 344 @SmallTest | 333 @SmallTest |
| 345 public void testSetLocalOfferMakesVideoFlowLocally() throws InterruptedExcepti
on { | 334 public void testSetLocalOfferMakesVideoFlowLocally() throws InterruptedExcepti
on { |
| 346 Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally"); | 335 Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally"); |
| 347 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); | 336 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); |
| 348 pcClient = createPeerConnectionClient(localRenderer, new MockRenderer(0, nul
l), | 337 pcClient = createPeerConnectionClient(localRenderer, new MockRenderer(0, nul
l), |
| 349 createParametersForVideoCall(VIDEO_CODEC_VP8), | 338 createParametersForVideoCall(VIDEO_CODEC_VP8), |
| 350 createCameraCapturer(false /* captureToTexture */), null); | 339 createCameraCapturer(false /* captureToTexture */)); |
| 351 | 340 |
| 352 // Wait for local SDP and ice candidates set events. | 341 // Wait for local SDP and ice candidates set events. |
| 353 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | 342 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
| 354 assertTrue("ICE candidates were not generated.", waitForIceCandidates(WAIT_T
IMEOUT)); | 343 assertTrue("ICE candidates were not generated.", waitForIceCandidates(WAIT_T
IMEOUT)); |
| 355 | 344 |
| 356 // Check that local video frames were rendered. | 345 // Check that local video frames were rendered. |
| 357 assertTrue( | 346 assertTrue( |
| 358 "Local video frames were not rendered.", localRenderer.waitForFramesRend
ered(WAIT_TIMEOUT)); | 347 "Local video frames were not rendered.", localRenderer.waitForFramesRend
ered(WAIT_TIMEOUT)); |
| 359 | 348 |
| 360 pcClient.close(); | 349 pcClient.close(); |
| 361 assertTrue( | 350 assertTrue( |
| 362 "PeerConnection close event was not received.", waitForPeerConnectionClo
sed(WAIT_TIMEOUT)); | 351 "PeerConnection close event was not received.", waitForPeerConnectionClo
sed(WAIT_TIMEOUT)); |
| 363 Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally Done."); | 352 Log.d(TAG, "testSetLocalOfferMakesVideoFlowLocally Done."); |
| 364 } | 353 } |
| 365 | 354 |
| 366 private void doLoopbackTest(PeerConnectionParameters parameters, VideoCapturer
videoCapturer, | 355 private void doLoopbackTest(PeerConnectionParameters parameters, VideoCapturer
videoCapturer, |
| 367 boolean decodeToTexture) throws InterruptedException { | 356 boolean decodeToTexture) throws InterruptedException { |
| 368 loopback = true; | 357 loopback = true; |
| 369 MockRenderer localRenderer = null; | 358 MockRenderer localRenderer = null; |
| 370 MockRenderer remoteRenderer = null; | 359 MockRenderer remoteRenderer = null; |
| 371 if (parameters.videoCallEnabled) { | 360 if (parameters.videoCallEnabled) { |
| 372 Log.d(TAG, "testLoopback for video " + parameters.videoCodec); | 361 Log.d(TAG, "testLoopback for video " + parameters.videoCodec); |
| 373 localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAM
E); | 362 localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAM
E); |
| 374 remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_N
AME); | 363 remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_N
AME); |
| 375 } else { | 364 } else { |
| 376 Log.d(TAG, "testLoopback for audio."); | 365 Log.d(TAG, "testLoopback for audio."); |
| 377 } | 366 } |
| 378 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, paramet
ers, videoCapturer, | 367 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, paramet
ers, videoCapturer); |
| 379 decodeToTexture ? eglBase.getEglBaseContext() : null); | |
| 380 | 368 |
| 381 // Wait for local SDP, rename it to answer and set as remote SDP. | 369 // Wait for local SDP, rename it to answer and set as remote SDP. |
| 382 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | 370 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
| 383 SessionDescription remoteSdp = new SessionDescription( | 371 SessionDescription remoteSdp = new SessionDescription( |
| 384 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); | 372 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); |
| 385 pcClient.setRemoteDescription(remoteSdp); | 373 pcClient.setRemoteDescription(remoteSdp); |
| 386 | 374 |
| 387 // Wait for ICE connection. | 375 // Wait for ICE connection. |
| 388 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); | 376 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); |
| 389 | 377 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 // TODO(perkj): If we can always capture to textures, there is no need to ch
eck if the | 462 // TODO(perkj): If we can always capture to textures, there is no need to ch
eck if the |
| 475 // hardware encoder supports to encode from a texture. | 463 // hardware encoder supports to encode from a texture. |
| 476 if (!MediaCodecVideoEncoder.isVp8HwSupportedUsingTextures()) { | 464 if (!MediaCodecVideoEncoder.isVp8HwSupportedUsingTextures()) { |
| 477 Log.i(TAG, "VP8 encode to textures is not supported."); | 465 Log.i(TAG, "VP8 encode to textures is not supported."); |
| 478 return; | 466 return; |
| 479 } | 467 } |
| 480 doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP8), | 468 doLoopbackTest(createParametersForVideoCall(VIDEO_CODEC_VP8), |
| 481 createCameraCapturer(true /* captureToTexture */), true /* decodeToTextu
re */); | 469 createCameraCapturer(true /* captureToTexture */), true /* decodeToTextu
re */); |
| 482 } | 470 } |
| 483 | 471 |
| 484 // Test that a call can be setup even if the EGL context used during initializ
ation is | |
| 485 // released before the Video codecs are created. The HW encoder and decoder is
setup to use | |
| 486 // textures. | |
| 487 @Test | |
| 488 @SmallTest | |
| 489 public void testLoopbackEglContextReleasedAfterCreatingPc() throws Interrupted
Exception { | |
| 490 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { | |
| 491 Log.i(TAG, "Decode to textures is not supported. Requires SDK version 19")
; | |
| 492 return; | |
| 493 } | |
| 494 | |
| 495 loopback = true; | |
| 496 PeerConnectionParameters parameters = createParametersForVideoCall(VIDEO_COD
EC_VP8); | |
| 497 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); | |
| 498 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); | |
| 499 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, paramet
ers, | |
| 500 createCameraCapturer(true /* captureToTexture */), eglBase.getEglBaseCon
text()); | |
| 501 | |
| 502 // Wait for local SDP, rename it to answer and set as remote SDP. | |
| 503 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | |
| 504 | |
| 505 // Release the EGL context used for creating the PeerConnectionClient. | |
| 506 // Since createPeerConnectionClient is asynchronous, we must wait for the lo
cal | |
| 507 // SessionDescription. | |
| 508 eglBase.release(); | |
| 509 eglBase = null; | |
| 510 | |
| 511 SessionDescription remoteSdp = new SessionDescription( | |
| 512 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); | |
| 513 pcClient.setRemoteDescription(remoteSdp); | |
| 514 | |
| 515 // Wait for ICE connection. | |
| 516 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); | |
| 517 // Check that local and remote video frames were rendered. | |
| 518 assertTrue( | |
| 519 "Local video frames were not rendered.", localRenderer.waitForFramesRend
ered(WAIT_TIMEOUT)); | |
| 520 assertTrue("Remote video frames were not rendered.", | |
| 521 remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT)); | |
| 522 | |
| 523 pcClient.close(); | |
| 524 assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT)); | |
| 525 Log.d(TAG, "testLoopback done."); | |
| 526 } | |
| 527 | |
| 528 @Test | 472 @Test |
| 529 @SmallTest | 473 @SmallTest |
| 530 public void testLoopbackH264CaptureToTexture() throws InterruptedException { | 474 public void testLoopbackH264CaptureToTexture() throws InterruptedException { |
| 531 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { | 475 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { |
| 532 Log.i(TAG, "Encode to textures is not supported. Requires KITKAT"); | 476 Log.i(TAG, "Encode to textures is not supported. Requires KITKAT"); |
| 533 return; | 477 return; |
| 534 } | 478 } |
| 535 // TODO(perkj): If we can always capture to textures, there is no need to ch
eck if the | 479 // TODO(perkj): If we can always capture to textures, there is no need to ch
eck if the |
| 536 // hardware encoder supports to encode from a texture. | 480 // hardware encoder supports to encode from a texture. |
| 537 if (!MediaCodecVideoEncoder.isH264HwSupportedUsingTextures()) { | 481 if (!MediaCodecVideoEncoder.isH264HwSupportedUsingTextures()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 548 @SmallTest | 492 @SmallTest |
| 549 public void testCameraSwitch() throws InterruptedException { | 493 public void testCameraSwitch() throws InterruptedException { |
| 550 Log.d(TAG, "testCameraSwitch"); | 494 Log.d(TAG, "testCameraSwitch"); |
| 551 loopback = true; | 495 loopback = true; |
| 552 | 496 |
| 553 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); | 497 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); |
| 554 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); | 498 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); |
| 555 | 499 |
| 556 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, | 500 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
| 557 createParametersForVideoCall(VIDEO_CODEC_VP8), | 501 createParametersForVideoCall(VIDEO_CODEC_VP8), |
| 558 createCameraCapturer(false /* captureToTexture */), null); | 502 createCameraCapturer(false /* captureToTexture */)); |
| 559 | 503 |
| 560 // Wait for local SDP, rename it to answer and set as remote SDP. | 504 // Wait for local SDP, rename it to answer and set as remote SDP. |
| 561 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | 505 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
| 562 SessionDescription remoteSdp = new SessionDescription( | 506 SessionDescription remoteSdp = new SessionDescription( |
| 563 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); | 507 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); |
| 564 pcClient.setRemoteDescription(remoteSdp); | 508 pcClient.setRemoteDescription(remoteSdp); |
| 565 | 509 |
| 566 // Wait for ICE connection. | 510 // Wait for ICE connection. |
| 567 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); | 511 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); |
| 568 | 512 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 596 @SmallTest | 540 @SmallTest |
| 597 public void testVideoSourceRestart() throws InterruptedException { | 541 public void testVideoSourceRestart() throws InterruptedException { |
| 598 Log.d(TAG, "testVideoSourceRestart"); | 542 Log.d(TAG, "testVideoSourceRestart"); |
| 599 loopback = true; | 543 loopback = true; |
| 600 | 544 |
| 601 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); | 545 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); |
| 602 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); | 546 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); |
| 603 | 547 |
| 604 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, | 548 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
| 605 createParametersForVideoCall(VIDEO_CODEC_VP8), | 549 createParametersForVideoCall(VIDEO_CODEC_VP8), |
| 606 createCameraCapturer(false /* captureToTexture */), null); | 550 createCameraCapturer(false /* captureToTexture */)); |
| 607 | 551 |
| 608 // Wait for local SDP, rename it to answer and set as remote SDP. | 552 // Wait for local SDP, rename it to answer and set as remote SDP. |
| 609 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | 553 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
| 610 SessionDescription remoteSdp = new SessionDescription( | 554 SessionDescription remoteSdp = new SessionDescription( |
| 611 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); | 555 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); |
| 612 pcClient.setRemoteDescription(remoteSdp); | 556 pcClient.setRemoteDescription(remoteSdp); |
| 613 | 557 |
| 614 // Wait for ICE connection. | 558 // Wait for ICE connection. |
| 615 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); | 559 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); |
| 616 | 560 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 645 @SmallTest | 589 @SmallTest |
| 646 public void testCaptureFormatChange() throws InterruptedException { | 590 public void testCaptureFormatChange() throws InterruptedException { |
| 647 Log.d(TAG, "testCaptureFormatChange"); | 591 Log.d(TAG, "testCaptureFormatChange"); |
| 648 loopback = true; | 592 loopback = true; |
| 649 | 593 |
| 650 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); | 594 MockRenderer localRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, LOCAL_R
ENDERER_NAME); |
| 651 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); | 595 MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE
_RENDERER_NAME); |
| 652 | 596 |
| 653 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, | 597 pcClient = createPeerConnectionClient(localRenderer, remoteRenderer, |
| 654 createParametersForVideoCall(VIDEO_CODEC_VP8), | 598 createParametersForVideoCall(VIDEO_CODEC_VP8), |
| 655 createCameraCapturer(false /* captureToTexture */), null); | 599 createCameraCapturer(false /* captureToTexture */)); |
| 656 | 600 |
| 657 // Wait for local SDP, rename it to answer and set as remote SDP. | 601 // Wait for local SDP, rename it to answer and set as remote SDP. |
| 658 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); | 602 assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT)); |
| 659 SessionDescription remoteSdp = new SessionDescription( | 603 SessionDescription remoteSdp = new SessionDescription( |
| 660 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); | 604 SessionDescription.Type.fromCanonicalForm("answer"), localSdp.descriptio
n); |
| 661 pcClient.setRemoteDescription(remoteSdp); | 605 pcClient.setRemoteDescription(remoteSdp); |
| 662 | 606 |
| 663 // Wait for ICE connection. | 607 // Wait for ICE connection. |
| 664 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); | 608 assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAI
T_TIMEOUT)); |
| 665 | 609 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 685 localRenderer.waitForFramesRendered(WAIT_TIMEOUT)); | 629 localRenderer.waitForFramesRendered(WAIT_TIMEOUT)); |
| 686 assertTrue("Remote video frames were not rendered after capture format cha
nge.", | 630 assertTrue("Remote video frames were not rendered after capture format cha
nge.", |
| 687 remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT)); | 631 remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT)); |
| 688 } | 632 } |
| 689 | 633 |
| 690 pcClient.close(); | 634 pcClient.close(); |
| 691 assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT)); | 635 assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT)); |
| 692 Log.d(TAG, "testCaptureFormatChange done."); | 636 Log.d(TAG, "testCaptureFormatChange done."); |
| 693 } | 637 } |
| 694 } | 638 } |
| OLD | NEW |