Java Code Examples for org.webrtc.PeerConnection.SignalingState

The following are top voted examples for showing how to use org.webrtc.PeerConnection.SignalingState. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 5 votes vote down vote up
private static void shutdownPC(PeerConnection pc, ObserverExpectations expectations) {
  if (expectations.dataChannel != null) {
    expectations.dataChannel.unregisterObserver();
    expectations.dataChannel.dispose();
  }
  expectations.expectStatsCallback();
  assertTrue(pc.getStats(expectations, null));
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));
  expectations.expectIceConnectionChange(IceConnectionState.CLOSED);
  expectations.expectSignalingChange(SignalingState.CLOSED);
  pc.close();
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));
  expectations.expectStatsCallback();
  assertTrue(pc.getStats(expectations, null));
  assertTrue(expectations.waitForAllExpectationsToBeSatisfied(TIMEOUT_SECONDS));

  System.out.println("FYI stats: ");
  int reportIndex = -1;
  for (StatsReport[] reports : expectations.takeStatsReports()) {
    System.out.println(" Report #" + (++reportIndex));
    for (int i = 0; i < reports.length; ++i) {
      System.out.println("  " + reports[i].toString());
    }
  }
  assertEquals(1, reportIndex);
  System.out.println("End stats.");

  pc.dispose();
}
 
Example 2
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 4 votes vote down vote up
public synchronized void expectSignalingChange(SignalingState newState) {
  expectedSignalingChanges.add(newState);
}
 
Example 3
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 4 votes vote down vote up
@Override
public synchronized void onSignalingChange(SignalingState newState) {
  assertEquals(expectedSignalingChanges.removeFirst(), newState);
}
 
Example 4
Project: AndroidRTC   File: PeerConnectionTest.java   Source Code and License 4 votes vote down vote up
private static void negotiate(PeerConnection offeringPC,
    ObserverExpectations offeringExpectations, PeerConnection answeringPC,
    ObserverExpectations answeringExpectations) {
  // Create offer.
  SdpObserverLatch sdpLatch = new SdpObserverLatch();
  offeringPC.createOffer(sdpLatch, new MediaConstraints());
  assertTrue(sdpLatch.await());
  SessionDescription 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);
  answeringPC.setRemoteDescription(sdpLatch, offerSdp);
  assertTrue(sdpLatch.await());
  assertNull(sdpLatch.getSdp());

  // Create answer.
  sdpLatch = new SdpObserverLatch();
  answeringPC.createAnswer(sdpLatch, new MediaConstraints());
  assertTrue(sdpLatch.await());
  SessionDescription 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());
}
 
Example 5
Project: webrtc-java   File: Observer.java   Source Code and License 4 votes vote down vote up
@Override
public synchronized void onSignalingChange(SignalingState newState) {
    System.out.println("DEBUG:  SIGNAL CHANGE"); 

}
 
Example 6
Project: licodeAndroidClient   File: LicodeConnector.java   Source Code and License 4 votes vote down vote up
@Override
public void onSignalingChange(SignalingState arg0) {
}
 
Example 7
Project: webrtc-workshop   File: PeerConnectionWrapper.java   Source Code and License votes vote down vote up
public void onSignalingChange(SignalingState signalingState) {}