Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java

Issue 2640433003: Android: AppRTCMobile: Don't leak CallActivity. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 }, runTimeMs); 339 }, runTimeMs);
340 } 340 }
341 341
342 peerConnectionClient = PeerConnectionClient.getInstance(); 342 peerConnectionClient = PeerConnectionClient.getInstance();
343 if (loopback) { 343 if (loopback) {
344 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options( ); 344 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options( );
345 options.networkIgnoreMask = 0; 345 options.networkIgnoreMask = 0;
346 peerConnectionClient.setPeerConnectionFactoryOptions(options); 346 peerConnectionClient.setPeerConnectionFactoryOptions(options);
347 } 347 }
348 peerConnectionClient.createPeerConnectionFactory( 348 peerConnectionClient.createPeerConnectionFactory(
349 CallActivity.this, peerConnectionParameters, CallActivity.this); 349 getApplicationContext(), peerConnectionParameters, CallActivity.this);
350 350
351 if (screencaptureEnabled) { 351 if (screencaptureEnabled) {
352 MediaProjectionManager mediaProjectionManager = 352 MediaProjectionManager mediaProjectionManager =
353 (MediaProjectionManager) getApplication().getSystemService( 353 (MediaProjectionManager) getApplication().getSystemService(
354 Context.MEDIA_PROJECTION_SERVICE); 354 Context.MEDIA_PROJECTION_SERVICE);
355 startActivityForResult( 355 startActivityForResult(
356 mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION _REQUEST_CODE); 356 mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION _REQUEST_CODE);
357 } else { 357 } else {
358 startCall(); 358 startCall();
359 } 359 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 activityRunning = true; 427 activityRunning = true;
428 // Video is not paused for screencapture. See onPause. 428 // Video is not paused for screencapture. See onPause.
429 if (peerConnectionClient != null && !screencaptureEnabled) { 429 if (peerConnectionClient != null && !screencaptureEnabled) {
430 peerConnectionClient.startVideoSource(); 430 peerConnectionClient.startVideoSource();
431 } 431 }
432 cpuMonitor.resume(); 432 cpuMonitor.resume();
433 } 433 }
434 434
435 @Override 435 @Override
436 protected void onDestroy() { 436 protected void onDestroy() {
437 Thread.setDefaultUncaughtExceptionHandler(null);
437 disconnect(); 438 disconnect();
438 if (logToast != null) { 439 if (logToast != null) {
439 logToast.cancel(); 440 logToast.cancel();
440 } 441 }
441 activityRunning = false; 442 activityRunning = false;
442 rootEglBase.release(); 443 rootEglBase.release();
443 super.onDestroy(); 444 super.onDestroy();
444 } 445 }
445 446
446 // CallFragment.OnCallEvents interface implementation. 447 // CallFragment.OnCallEvents interface implementation.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 return; 524 return;
524 } 525 }
525 callStartedTimeMs = System.currentTimeMillis(); 526 callStartedTimeMs = System.currentTimeMillis();
526 527
527 // Start room connection. 528 // Start room connection.
528 logAndToast(getString(R.string.connecting_to, roomConnectionParameters.roomU rl)); 529 logAndToast(getString(R.string.connecting_to, roomConnectionParameters.roomU rl));
529 appRtcClient.connectToRoom(roomConnectionParameters); 530 appRtcClient.connectToRoom(roomConnectionParameters);
530 531
531 // Create and audio manager that will take care of audio routing, 532 // Create and audio manager that will take care of audio routing,
532 // audio modes, audio device enumeration etc. 533 // audio modes, audio device enumeration etc.
533 audioManager = AppRTCAudioManager.create(this); 534 audioManager = AppRTCAudioManager.create(getApplicationContext());
534 // Store existing audio settings and change audio mode to 535 // Store existing audio settings and change audio mode to
535 // MODE_IN_COMMUNICATION for best possible VoIP performance. 536 // MODE_IN_COMMUNICATION for best possible VoIP performance.
536 Log.d(TAG, "Starting the audio manager..."); 537 Log.d(TAG, "Starting the audio manager...");
537 audioManager.start(new AudioManagerEvents() { 538 audioManager.start(new AudioManagerEvents() {
538 // This method will be called each time the number of available audio 539 // This method will be called each time the number of available audio
539 // devices has changed. 540 // devices has changed.
540 @Override 541 @Override
541 public void onAudioDeviceChanged( 542 public void onAudioDeviceChanged(
542 AudioDevice audioDevice, Set<AudioDevice> availableAudioDevices) { 543 AudioDevice audioDevice, Set<AudioDevice> availableAudioDevices) {
543 onAudioManagerDevicesChanged(audioDevice, availableAudioDevices); 544 onAudioManagerDevicesChanged(audioDevice, availableAudioDevices);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 890 }
890 } 891 }
891 }); 892 });
892 } 893 }
893 894
894 @Override 895 @Override
895 public void onPeerConnectionError(final String description) { 896 public void onPeerConnectionError(final String description) {
896 reportError(description); 897 reportError(description);
897 } 898 }
898 } 899 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698