// 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(); } }
/** stop all streams from being cast to the server */ void doUnpublish() { for (String key : mLocalStream.keySet()) { final StreamDescription stream = mLocalStream.get(key); if (stream != null && stream.isLocal()) { stream.pc.removeStream(lMS); for (RoomObserver obs : mObservers) { obs.onStreamRemoved(stream); } if (mObservers.size() == 0) { destroy(stream); } } } mLocalStream.clear(); if (lMS != null) { lMS.dispose(); } if (mVideoCapturer != null) { mVideoCapturer.dispose(); } lMS = null; mVideoCapturer = null; if (mVideoSource != null && !mVideoStopped) { mVideoSource.stop(); } mVideoSource = null; }
@Override public void onResume() { super.onResume(); vsv.onResume(); if (videoSource != null && videoSourceStopped) { videoSource.restart(); } }
@Override public void onPause() { super.onPause(); vsv.onPause(); if (videoSource != null) { videoSource.stop(); videoSourceStopped = true; } }
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(); }