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 |
11 package org.appspot.apprtc; | 11 package org.appspot.apprtc; |
12 | 12 |
13 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; | |
14 import org.appspot.apprtc.AppRTCClient.SignalingParameters; | |
15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; | |
16 import org.appspot.apprtc.util.LooperExecutor; | |
17 | |
18 import android.app.Activity; | 13 import android.app.Activity; |
19 import android.app.AlertDialog; | 14 import android.app.AlertDialog; |
20 import android.app.FragmentTransaction; | 15 import android.app.FragmentTransaction; |
21 import android.content.DialogInterface; | 16 import android.content.DialogInterface; |
22 import android.content.Intent; | 17 import android.content.Intent; |
23 import android.content.pm.PackageManager; | 18 import android.content.pm.PackageManager; |
24 import android.net.Uri; | 19 import android.net.Uri; |
25 import android.os.Bundle; | 20 import android.os.Bundle; |
26 import android.os.Handler; | 21 import android.os.Handler; |
27 import android.util.Log; | 22 import android.util.Log; |
28 import android.view.View; | 23 import android.view.View; |
29 import android.view.Window; | 24 import android.view.Window; |
30 import android.view.WindowManager.LayoutParams; | 25 import android.view.WindowManager.LayoutParams; |
31 import android.widget.Toast; | 26 import android.widget.Toast; |
32 | 27 |
| 28 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; |
| 29 import org.appspot.apprtc.AppRTCClient.SignalingParameters; |
| 30 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; |
| 31 import org.appspot.apprtc.util.LooperExecutor; |
33 import org.webrtc.EglBase; | 32 import org.webrtc.EglBase; |
34 import org.webrtc.IceCandidate; | 33 import org.webrtc.IceCandidate; |
35 import org.webrtc.PeerConnectionFactory; | 34 import org.webrtc.PeerConnectionFactory; |
| 35 import org.webrtc.RendererCommon.ScalingType; |
36 import org.webrtc.SessionDescription; | 36 import org.webrtc.SessionDescription; |
37 import org.webrtc.StatsReport; | 37 import org.webrtc.StatsReport; |
38 import org.webrtc.RendererCommon.ScalingType; | |
39 import org.webrtc.SurfaceViewRenderer; | 38 import org.webrtc.SurfaceViewRenderer; |
40 | 39 |
41 /** | 40 /** |
42 * Activity for peer connection call setup, call waiting | 41 * Activity for peer connection call setup, call waiting |
43 * and call view. | 42 * and call view. |
44 */ | 43 */ |
45 public class CallActivity extends Activity | 44 public class CallActivity extends Activity |
46 implements AppRTCClient.SignalingEvents, | 45 implements AppRTCClient.SignalingEvents, |
47 PeerConnectionClient.PeerConnectionEvents, | 46 PeerConnectionClient.PeerConnectionEvents, |
48 CallFragment.OnCallEvents { | 47 CallFragment.OnCallEvents { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false)); | 237 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false)); |
239 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); | 238 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); |
240 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); | 239 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); |
241 | 240 |
242 // Create connection client. Use DirectRTCClient if room name is an IP other
wise use the | 241 // Create connection client. Use DirectRTCClient if room name is an IP other
wise use the |
243 // standard WebSocketRTCClient. | 242 // standard WebSocketRTCClient. |
244 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { | 243 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { |
245 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor()); | 244 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor()); |
246 } else { | 245 } else { |
247 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); | 246 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); |
248 appRtcClient = new DirectRTCClient(this, new LooperExecutor()); | 247 appRtcClient = new DirectRTCClient(this); |
249 } | 248 } |
250 // Create connection parameters. | 249 // Create connection parameters. |
251 roomConnectionParameters = new RoomConnectionParameters( | 250 roomConnectionParameters = new RoomConnectionParameters( |
252 roomUri.toString(), roomId, loopback); | 251 roomUri.toString(), roomId, loopback); |
253 | 252 |
254 // Create CPU monitor | 253 // Create CPU monitor |
255 cpuMonitor = new CpuMonitor(this); | 254 cpuMonitor = new CpuMonitor(this); |
256 hudFragment.setCpuMonitor(cpuMonitor); | 255 hudFragment.setCpuMonitor(cpuMonitor); |
257 | 256 |
258 // Send intent arguments to fragments. | 257 // Send intent arguments to fragments. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 } | 306 } |
308 | 307 |
309 @Override | 308 @Override |
310 protected void onDestroy() { | 309 protected void onDestroy() { |
311 disconnect(); | 310 disconnect(); |
312 if (logToast != null) { | 311 if (logToast != null) { |
313 logToast.cancel(); | 312 logToast.cancel(); |
314 } | 313 } |
315 activityRunning = false; | 314 activityRunning = false; |
316 rootEglBase.release(); | 315 rootEglBase.release(); |
317 if (cpuMonitor != null) { | |
318 cpuMonitor.release(); | |
319 } | |
320 super.onDestroy(); | 316 super.onDestroy(); |
321 } | 317 } |
322 | 318 |
323 // CallFragment.OnCallEvents interface implementation. | 319 // CallFragment.OnCallEvents interface implementation. |
324 @Override | 320 @Override |
325 public void onCallHangUp() { | 321 public void onCallHangUp() { |
326 disconnect(); | 322 disconnect(); |
327 } | 323 } |
328 | 324 |
329 @Override | 325 @Override |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 } | 704 } |
709 } | 705 } |
710 }); | 706 }); |
711 } | 707 } |
712 | 708 |
713 @Override | 709 @Override |
714 public void onPeerConnectionError(final String description) { | 710 public void onPeerConnectionError(final String description) { |
715 reportError(description); | 711 reportError(description); |
716 } | 712 } |
717 } | 713 } |
OLD | NEW |