| OLD | NEW |
| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 target.renderFrame(frame); | 148 target.renderFrame(frame); |
| 149 } | 149 } |
| 150 | 150 |
| 151 synchronized public void setTarget(VideoRenderer.Callbacks target) { | 151 synchronized public void setTarget(VideoRenderer.Callbacks target) { |
| 152 this.target = target; | 152 this.target = target; |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 public interface CountingResource { |
| 157 public void increment(); |
| 158 public void decrement(); |
| 159 } |
| 160 public CountingResource countingResource; |
| 161 |
| 156 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer(); | 162 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer(); |
| 157 private final ProxyRenderer localProxyRenderer = new ProxyRenderer(); | 163 private final ProxyRenderer localProxyRenderer = new ProxyRenderer(); |
| 158 private PeerConnectionClient peerConnectionClient = null; | 164 private PeerConnectionClient peerConnectionClient = null; |
| 159 private AppRTCClient appRtcClient; | 165 private AppRTCClient appRtcClient; |
| 160 private SignalingParameters signalingParameters; | 166 private SignalingParameters signalingParameters; |
| 161 private AppRTCAudioManager audioManager = null; | 167 private AppRTCAudioManager audioManager = null; |
| 162 private EglBase rootEglBase; | 168 private EglBase rootEglBase; |
| 163 private SurfaceViewRenderer pipRenderer; | 169 private SurfaceViewRenderer pipRenderer; |
| 164 private SurfaceViewRenderer fullscreenRenderer; | 170 private SurfaceViewRenderer fullscreenRenderer; |
| 165 private VideoFileRenderer videoFileRenderer; | 171 private VideoFileRenderer videoFileRenderer; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 peerConnectionClient.createPeerConnectionFactory( | 377 peerConnectionClient.createPeerConnectionFactory( |
| 372 getApplicationContext(), peerConnectionParameters, CallActivity.this); | 378 getApplicationContext(), peerConnectionParameters, CallActivity.this); |
| 373 | 379 |
| 374 if (screencaptureEnabled) { | 380 if (screencaptureEnabled) { |
| 375 startScreenCapture(); | 381 startScreenCapture(); |
| 376 } else { | 382 } else { |
| 377 startCall(); | 383 startCall(); |
| 378 } | 384 } |
| 379 } | 385 } |
| 380 | 386 |
| 387 public CountingResource getCountingResource() { |
| 388 return countingResource; |
| 389 } |
| 390 |
| 391 public void setCountingResource(CountingResource r) { |
| 392 countingResource = r; |
| 393 } |
| 394 |
| 381 @TargetApi(17) | 395 @TargetApi(17) |
| 382 private DisplayMetrics getDisplayMetrics() { | 396 private DisplayMetrics getDisplayMetrics() { |
| 383 DisplayMetrics displayMetrics = new DisplayMetrics(); | 397 DisplayMetrics displayMetrics = new DisplayMetrics(); |
| 384 WindowManager windowManager = | 398 WindowManager windowManager = |
| 385 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE
); | 399 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE
); |
| 386 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); | 400 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); |
| 387 return displayMetrics; | 401 return displayMetrics; |
| 388 } | 402 } |
| 389 | 403 |
| 390 @TargetApi(19) | 404 @TargetApi(19) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 activityRunning = true; | 502 activityRunning = true; |
| 489 // Video is not paused for screencapture. See onPause. | 503 // Video is not paused for screencapture. See onPause. |
| 490 if (peerConnectionClient != null && !screencaptureEnabled) { | 504 if (peerConnectionClient != null && !screencaptureEnabled) { |
| 491 peerConnectionClient.startVideoSource(); | 505 peerConnectionClient.startVideoSource(); |
| 492 } | 506 } |
| 493 cpuMonitor.resume(); | 507 cpuMonitor.resume(); |
| 494 } | 508 } |
| 495 | 509 |
| 496 @Override | 510 @Override |
| 497 protected void onDestroy() { | 511 protected void onDestroy() { |
| 512 Log.d(TAG, "onDestroy()"); |
| 513 if (countingResource != null) { |
| 514 countingResource.increment(); |
| 515 } |
| 498 Thread.setDefaultUncaughtExceptionHandler(null); | 516 Thread.setDefaultUncaughtExceptionHandler(null); |
| 499 disconnect(); | 517 disconnect(); |
| 500 if (logToast != null) { | 518 if (logToast != null) { |
| 501 logToast.cancel(); | 519 logToast.cancel(); |
| 502 } | 520 } |
| 503 activityRunning = false; | 521 activityRunning = false; |
| 504 rootEglBase.release(); | 522 rootEglBase.release(); |
| 505 super.onDestroy(); | 523 super.onDestroy(); |
| 524 if (countingResource != null) { |
| 525 countingResource.decrement(); |
| 526 } |
| 506 } | 527 } |
| 507 | 528 |
| 508 // CallFragment.OnCallEvents interface implementation. | 529 // CallFragment.OnCallEvents interface implementation. |
| 509 @Override | 530 @Override |
| 510 public void onCallHangUp() { | 531 public void onCallHangUp() { |
| 511 disconnect(); | 532 disconnect(); |
| 512 } | 533 } |
| 513 | 534 |
| 514 @Override | 535 @Override |
| 515 public void onCameraSwitch() { | 536 public void onCameraSwitch() { |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 } | 951 } |
| 931 } | 952 } |
| 932 }); | 953 }); |
| 933 } | 954 } |
| 934 | 955 |
| 935 @Override | 956 @Override |
| 936 public void onPeerConnectionError(final String description) { | 957 public void onPeerConnectionError(final String description) { |
| 937 reportError(description); | 958 reportError(description); |
| 938 } | 959 } |
| 939 } | 960 } |
| OLD | NEW |