Android: AppRTCMobile: Don't leak CallActivity.
Previously CallActivity would be leaked on every call. This CL fixes the problem. BUG=webrtc:6684 Review-Url: https://codereview.webrtc.org/2640433003 Cr-Commit-Position: refs/heads/master@{#16123}
This commit is contained in:
@ -346,7 +346,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
peerConnectionClient.setPeerConnectionFactoryOptions(options);
|
||||
}
|
||||
peerConnectionClient.createPeerConnectionFactory(
|
||||
CallActivity.this, peerConnectionParameters, CallActivity.this);
|
||||
getApplicationContext(), peerConnectionParameters, CallActivity.this);
|
||||
|
||||
if (screencaptureEnabled) {
|
||||
MediaProjectionManager mediaProjectionManager =
|
||||
@ -434,6 +434,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
Thread.setDefaultUncaughtExceptionHandler(null);
|
||||
disconnect();
|
||||
if (logToast != null) {
|
||||
logToast.cancel();
|
||||
@ -530,7 +531,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
|
||||
|
||||
// Create and audio manager that will take care of audio routing,
|
||||
// audio modes, audio device enumeration etc.
|
||||
audioManager = AppRTCAudioManager.create(this);
|
||||
audioManager = AppRTCAudioManager.create(getApplicationContext());
|
||||
// Store existing audio settings and change audio mode to
|
||||
// MODE_IN_COMMUNICATION for best possible VoIP performance.
|
||||
Log.d(TAG, "Starting the audio manager...");
|
||||
|
||||
@ -92,7 +92,6 @@ public class PeerConnectionClient {
|
||||
private final SDPObserver sdpObserver = new SDPObserver();
|
||||
private final ScheduledExecutorService executor;
|
||||
|
||||
private Context context;
|
||||
private PeerConnectionFactory factory;
|
||||
private PeerConnection peerConnection;
|
||||
PeerConnectionFactory.Options options = null;
|
||||
@ -292,7 +291,6 @@ public class PeerConnectionClient {
|
||||
videoCallEnabled = peerConnectionParameters.videoCallEnabled;
|
||||
dataChannelEnabled = peerConnectionParameters.dataChannelParameters != null;
|
||||
// Reset variables to initial states.
|
||||
this.context = null;
|
||||
factory = null;
|
||||
peerConnection = null;
|
||||
preferIsac = false;
|
||||
@ -459,7 +457,6 @@ public class PeerConnectionClient {
|
||||
if (options != null) {
|
||||
Log.d(TAG, "Factory networkIgnoreMask option: " + options.networkIgnoreMask);
|
||||
}
|
||||
this.context = context;
|
||||
factory = new PeerConnectionFactory(options);
|
||||
Log.d(TAG, "Peer connection factory created.");
|
||||
}
|
||||
@ -639,6 +636,8 @@ public class PeerConnectionClient {
|
||||
videoSource.dispose();
|
||||
videoSource = null;
|
||||
}
|
||||
localRender = null;
|
||||
remoteRenders = null;
|
||||
Log.d(TAG, "Closing peer connection factory.");
|
||||
if (factory != null) {
|
||||
factory.dispose();
|
||||
@ -649,6 +648,7 @@ public class PeerConnectionClient {
|
||||
events.onPeerConnectionClosed();
|
||||
PeerConnectionFactory.stopInternalTracingCapture();
|
||||
PeerConnectionFactory.shutdownInternalTracer();
|
||||
events = null;
|
||||
}
|
||||
|
||||
public boolean isHDVideo() {
|
||||
|
||||
Reference in New Issue
Block a user