// Disconnect from remote resources, dispose of local resources, and exit.
 private void disconnectAndExit() {
   synchronized (quit[0]) {
     if (quit[0]) {
       return;
     }
     quit[0] = true;
     if (pc != null) {
       pc.dispose();
       pc = null;
     }
     if (appRtcClient != null) {
       appRtcClient.sendMessage("{\"type\": \"bye\"}");
       appRtcClient.disconnect();
       appRtcClient = null;
     }
     if (videoSource != null) {
       videoSource.dispose();
       videoSource = null;
     }
     if (factory != null) {
       factory.dispose();
       factory = null;
     }
     finish();
   }
 }
Beispiel #2
0
 private void closeInternal() {
   if (factory != null && peerConnectionParameters.aecDump) {
     factory.stopAecDump();
   }
   Log.d(TAG, "Closing peer connection.");
   statsTimer.cancel();
   if (peerConnection != null) {
     peerConnection.dispose();
     peerConnection = null;
   }
   Log.d(TAG, "Closing audio source.");
   if (audioSource != null) {
     audioSource.dispose();
     audioSource = null;
   }
   Log.d(TAG, "Stopping capture.");
   if (videoCapturer != null) {
     try {
       videoCapturer.stopCapture();
     } catch (InterruptedException e) {
       throw new RuntimeException(e);
     }
     videoCapturer.dispose();
     videoCapturer = null;
   }
   Log.d(TAG, "Closing video source.");
   if (videoSource != null) {
     videoSource.dispose();
     videoSource = null;
   }
   Log.d(TAG, "Closing peer connection factory.");
   if (factory != null) {
     factory.dispose();
     factory = null;
   }
   options = null;
   Log.d(TAG, "Closing peer connection done.");
   events.onPeerConnectionClosed();
   PeerConnectionFactory.stopInternalTracingCapture();
   PeerConnectionFactory.shutdownInternalTracer();
 }
 private void closeInternal() {
   Log.d(TAG, "Closing peer connection.");
   statsTimer.cancel();
   if (peerConnection != null) {
     peerConnection.dispose();
     peerConnection = null;
   }
   Log.d(TAG, "Closing video source.");
   if (videoSource != null) {
     videoSource.dispose();
     videoSource = null;
   }
   Log.d(TAG, "Closing peer connection factory.");
   if (factory != null) {
     factory.dispose();
     factory = null;
   }
   options = null;
   Log.d(TAG, "Closing peer connection done.");
   events.onPeerConnectionClosed();
 }