Example #1
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();
 }