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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 try { | 74 try { |
75 System.loadLibrary("c++_shared"); | 75 System.loadLibrary("c++_shared"); |
76 System.loadLibrary("boringssl.cr"); | 76 System.loadLibrary("boringssl.cr"); |
77 System.loadLibrary("protobuf_lite.cr"); | 77 System.loadLibrary("protobuf_lite.cr"); |
78 } catch (UnsatisfiedLinkError e) { | 78 } catch (UnsatisfiedLinkError e) { |
79 Logging.w(TAG, "Failed to load native dependencies: ", e); | 79 Logging.w(TAG, "Failed to load native dependencies: ", e); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID"; | 83 public static final String EXTRA_ROOMID = "org.appspot.apprtc.ROOMID"; |
| 84 public static final String EXTRA_COLLIDERURL = "org.appspot.apprtc.COLLIDERURL
"; |
84 public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK"; | 85 public static final String EXTRA_LOOPBACK = "org.appspot.apprtc.LOOPBACK"; |
85 public static final String EXTRA_VIDEO_CALL = "org.appspot.apprtc.VIDEO_CALL"; | 86 public static final String EXTRA_VIDEO_CALL = "org.appspot.apprtc.VIDEO_CALL"; |
86 public static final String EXTRA_SCREENCAPTURE = "org.appspot.apprtc.SCREENCAP
TURE"; | 87 public static final String EXTRA_SCREENCAPTURE = "org.appspot.apprtc.SCREENCAP
TURE"; |
87 public static final String EXTRA_CAMERA2 = "org.appspot.apprtc.CAMERA2"; | 88 public static final String EXTRA_CAMERA2 = "org.appspot.apprtc.CAMERA2"; |
88 public static final String EXTRA_VIDEO_WIDTH = "org.appspot.apprtc.VIDEO_WIDTH
"; | 89 public static final String EXTRA_VIDEO_WIDTH = "org.appspot.apprtc.VIDEO_WIDTH
"; |
89 public static final String EXTRA_VIDEO_HEIGHT = "org.appspot.apprtc.VIDEO_HEIG
HT"; | 90 public static final String EXTRA_VIDEO_HEIGHT = "org.appspot.apprtc.VIDEO_HEIG
HT"; |
90 public static final String EXTRA_VIDEO_FPS = "org.appspot.apprtc.VIDEO_FPS"; | 91 public static final String EXTRA_VIDEO_FPS = "org.appspot.apprtc.VIDEO_FPS"; |
91 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED = | 92 public static final String EXTRA_VIDEO_CAPTUREQUALITYSLIDER_ENABLED = |
92 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER"; | 93 "org.appsopt.apprtc.VIDEO_CAPTUREQUALITYSLIDER"; |
93 public static final String EXTRA_VIDEO_BITRATE = "org.appspot.apprtc.VIDEO_BIT
RATE"; | 94 public static final String EXTRA_VIDEO_BITRATE = "org.appspot.apprtc.VIDEO_BIT
RATE"; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 | 148 |
148 target.renderFrame(frame); | 149 target.renderFrame(frame); |
149 } | 150 } |
150 | 151 |
151 synchronized public void setTarget(VideoRenderer.Callbacks target) { | 152 synchronized public void setTarget(VideoRenderer.Callbacks target) { |
152 this.target = target; | 153 this.target = target; |
153 } | 154 } |
154 } | 155 } |
155 | 156 |
| 157 public interface CountingResource { |
| 158 public void increment(); |
| 159 public void decrement(); |
| 160 } |
| 161 public CountingResource countingResource; |
| 162 |
156 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer(); | 163 private final ProxyRenderer remoteProxyRenderer = new ProxyRenderer(); |
157 private final ProxyRenderer localProxyRenderer = new ProxyRenderer(); | 164 private final ProxyRenderer localProxyRenderer = new ProxyRenderer(); |
158 private PeerConnectionClient peerConnectionClient = null; | 165 private PeerConnectionClient peerConnectionClient = null; |
159 private AppRTCClient appRtcClient; | 166 private AppRTCClient appRtcClient; |
160 private SignalingParameters signalingParameters; | 167 private SignalingParameters signalingParameters; |
161 private AppRTCAudioManager audioManager = null; | 168 private AppRTCAudioManager audioManager = null; |
162 private EglBase rootEglBase; | 169 private EglBase rootEglBase; |
163 private SurfaceViewRenderer pipRenderer; | 170 private SurfaceViewRenderer pipRenderer; |
164 private SurfaceViewRenderer fullscreenRenderer; | 171 private SurfaceViewRenderer fullscreenRenderer; |
165 private VideoFileRenderer videoFileRenderer; | 172 private VideoFileRenderer videoFileRenderer; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 | 337 |
331 // Create connection client. Use DirectRTCClient if room name is an IP other
wise use the | 338 // Create connection client. Use DirectRTCClient if room name is an IP other
wise use the |
332 // standard WebSocketRTCClient. | 339 // standard WebSocketRTCClient. |
333 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { | 340 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { |
334 appRtcClient = new WebSocketRTCClient(this); | 341 appRtcClient = new WebSocketRTCClient(this); |
335 } else { | 342 } else { |
336 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); | 343 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); |
337 appRtcClient = new DirectRTCClient(this); | 344 appRtcClient = new DirectRTCClient(this); |
338 } | 345 } |
339 // Create connection parameters. | 346 // Create connection parameters. |
340 roomConnectionParameters = new RoomConnectionParameters(roomUri.toString(),
roomId, loopback); | 347 String colliderUrl = intent.getStringExtra(EXTRA_COLLIDERURL); |
| 348 roomConnectionParameters = |
| 349 new RoomConnectionParameters(roomUri.toString(), roomId, loopback, colli
derUrl); |
341 | 350 |
342 // Create CPU monitor | 351 // Create CPU monitor |
343 cpuMonitor = new CpuMonitor(this); | 352 cpuMonitor = new CpuMonitor(this); |
344 hudFragment.setCpuMonitor(cpuMonitor); | 353 hudFragment.setCpuMonitor(cpuMonitor); |
345 | 354 |
346 // Send intent arguments to fragments. | 355 // Send intent arguments to fragments. |
347 callFragment.setArguments(intent.getExtras()); | 356 callFragment.setArguments(intent.getExtras()); |
348 hudFragment.setArguments(intent.getExtras()); | 357 hudFragment.setArguments(intent.getExtras()); |
349 // Activate call and HUD fragments and start the call. | 358 // Activate call and HUD fragments and start the call. |
350 FragmentTransaction ft = getFragmentManager().beginTransaction(); | 359 FragmentTransaction ft = getFragmentManager().beginTransaction(); |
(...skipping 20 matching lines...) Expand all Loading... |
371 peerConnectionClient.createPeerConnectionFactory( | 380 peerConnectionClient.createPeerConnectionFactory( |
372 getApplicationContext(), peerConnectionParameters, CallActivity.this); | 381 getApplicationContext(), peerConnectionParameters, CallActivity.this); |
373 | 382 |
374 if (screencaptureEnabled) { | 383 if (screencaptureEnabled) { |
375 startScreenCapture(); | 384 startScreenCapture(); |
376 } else { | 385 } else { |
377 startCall(); | 386 startCall(); |
378 } | 387 } |
379 } | 388 } |
380 | 389 |
| 390 public CountingResource getCountingResource() { |
| 391 return countingResource; |
| 392 } |
| 393 |
| 394 public void setCountingResource(CountingResource r) { |
| 395 countingResource = r; |
| 396 } |
| 397 |
381 @TargetApi(17) | 398 @TargetApi(17) |
382 private DisplayMetrics getDisplayMetrics() { | 399 private DisplayMetrics getDisplayMetrics() { |
383 DisplayMetrics displayMetrics = new DisplayMetrics(); | 400 DisplayMetrics displayMetrics = new DisplayMetrics(); |
384 WindowManager windowManager = | 401 WindowManager windowManager = |
385 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE
); | 402 (WindowManager) getApplication().getSystemService(Context.WINDOW_SERVICE
); |
386 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); | 403 windowManager.getDefaultDisplay().getRealMetrics(displayMetrics); |
387 return displayMetrics; | 404 return displayMetrics; |
388 } | 405 } |
389 | 406 |
390 @TargetApi(19) | 407 @TargetApi(19) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 activityRunning = true; | 505 activityRunning = true; |
489 // Video is not paused for screencapture. See onPause. | 506 // Video is not paused for screencapture. See onPause. |
490 if (peerConnectionClient != null && !screencaptureEnabled) { | 507 if (peerConnectionClient != null && !screencaptureEnabled) { |
491 peerConnectionClient.startVideoSource(); | 508 peerConnectionClient.startVideoSource(); |
492 } | 509 } |
493 cpuMonitor.resume(); | 510 cpuMonitor.resume(); |
494 } | 511 } |
495 | 512 |
496 @Override | 513 @Override |
497 protected void onDestroy() { | 514 protected void onDestroy() { |
| 515 Log.d(TAG, "onDestroy()"); |
| 516 if (countingResource != null) { |
| 517 countingResource.increment(); |
| 518 } |
498 Thread.setDefaultUncaughtExceptionHandler(null); | 519 Thread.setDefaultUncaughtExceptionHandler(null); |
499 disconnect(); | 520 disconnect(); |
500 if (logToast != null) { | 521 if (logToast != null) { |
501 logToast.cancel(); | 522 logToast.cancel(); |
502 } | 523 } |
503 activityRunning = false; | 524 activityRunning = false; |
504 rootEglBase.release(); | 525 rootEglBase.release(); |
505 super.onDestroy(); | 526 super.onDestroy(); |
| 527 if (countingResource != null) { |
| 528 countingResource.decrement(); |
| 529 } |
506 } | 530 } |
507 | 531 |
508 // CallFragment.OnCallEvents interface implementation. | 532 // CallFragment.OnCallEvents interface implementation. |
509 @Override | 533 @Override |
510 public void onCallHangUp() { | 534 public void onCallHangUp() { |
511 disconnect(); | 535 disconnect(); |
512 } | 536 } |
513 | 537 |
514 @Override | 538 @Override |
515 public void onCameraSwitch() { | 539 public void onCameraSwitch() { |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 } | 954 } |
931 } | 955 } |
932 }); | 956 }); |
933 } | 957 } |
934 | 958 |
935 @Override | 959 @Override |
936 public void onPeerConnectionError(final String description) { | 960 public void onPeerConnectionError(final String description) { |
937 reportError(description); | 961 reportError(description); |
938 } | 962 } |
939 } | 963 } |
OLD | NEW |