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

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

Issue 1992213002: Replace LooperExecutor with built-in class in Android AppRTC Demo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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
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
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters; 13 import org.appspot.apprtc.AppRTCClient.RoomConnectionParameters;
14 import org.appspot.apprtc.AppRTCClient.SignalingParameters; 14 import org.appspot.apprtc.AppRTCClient.SignalingParameters;
15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters; 15 import org.appspot.apprtc.PeerConnectionClient.PeerConnectionParameters;
16 import org.appspot.apprtc.util.LooperExecutor;
17 16
18 import android.app.Activity; 17 import android.app.Activity;
19 import android.app.AlertDialog; 18 import android.app.AlertDialog;
20 import android.app.FragmentTransaction; 19 import android.app.FragmentTransaction;
21 import android.content.DialogInterface; 20 import android.content.DialogInterface;
22 import android.content.Intent; 21 import android.content.Intent;
23 import android.content.pm.PackageManager; 22 import android.content.pm.PackageManager;
24 import android.net.Uri; 23 import android.net.Uri;
25 import android.os.Bundle; 24 import android.os.Bundle;
26 import android.os.Handler; 25 import android.os.Handler;
27 import android.util.Log; 26 import android.util.Log;
28 import android.view.View; 27 import android.view.View;
29 import android.view.Window; 28 import android.view.Window;
30 import android.view.WindowManager.LayoutParams; 29 import android.view.WindowManager.LayoutParams;
31 import android.widget.Toast; 30 import android.widget.Toast;
32 31
32 import org.appspot.apprtc.util.LooperExecutor;
magjed_webrtc 2016/05/19 12:07:54 Move this import back to the other org.appspot.app
sakal 2016/05/19 12:39:03 Done.
33 import org.webrtc.EglBase; 33 import org.webrtc.EglBase;
34 import org.webrtc.IceCandidate; 34 import org.webrtc.IceCandidate;
35 import org.webrtc.PeerConnectionFactory; 35 import org.webrtc.PeerConnectionFactory;
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; 38 import org.webrtc.RendererCommon.ScalingType;
39 import org.webrtc.SurfaceViewRenderer; 39 import org.webrtc.SurfaceViewRenderer;
40 40
41 import java.util.concurrent.Executors;
magjed_webrtc 2016/05/19 12:07:54 not used?
sakal 2016/05/19 12:39:03 Done.
42
41 /** 43 /**
42 * Activity for peer connection call setup, call waiting 44 * Activity for peer connection call setup, call waiting
43 * and call view. 45 * and call view.
44 */ 46 */
45 public class CallActivity extends Activity 47 public class CallActivity extends Activity
46 implements AppRTCClient.SignalingEvents, 48 implements AppRTCClient.SignalingEvents,
47 PeerConnectionClient.PeerConnectionEvents, 49 PeerConnectionClient.PeerConnectionEvents,
48 CallFragment.OnCallEvents { 50 CallFragment.OnCallEvents {
49 51
50 public static final String EXTRA_ROOMID = 52 public static final String EXTRA_ROOMID =
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false)); 240 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false));
239 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); 241 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
240 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); 242 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
241 243
242 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the 244 // Create connection client. Use DirectRTCClient if room name is an IP other wise use the
243 // standard WebSocketRTCClient. 245 // standard WebSocketRTCClient.
244 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) { 246 if (loopback || !DirectRTCClient.IP_PATTERN.matcher(roomId).matches()) {
245 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor()); 247 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor());
246 } else { 248 } else {
247 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP."); 249 Log.i(TAG, "Using DirectRTCClient because room name looks like an IP.");
248 appRtcClient = new DirectRTCClient(this, new LooperExecutor()); 250 appRtcClient = new DirectRTCClient(this);
249 } 251 }
250 // Create connection parameters. 252 // Create connection parameters.
251 roomConnectionParameters = new RoomConnectionParameters( 253 roomConnectionParameters = new RoomConnectionParameters(
252 roomUri.toString(), roomId, loopback); 254 roomUri.toString(), roomId, loopback);
253 255
254 // Create CPU monitor 256 // Create CPU monitor
255 cpuMonitor = new CpuMonitor(this); 257 cpuMonitor = new CpuMonitor(this);
256 hudFragment.setCpuMonitor(cpuMonitor); 258 hudFragment.setCpuMonitor(cpuMonitor);
257 259
258 // Send intent arguments to fragments. 260 // Send intent arguments to fragments.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 309 }
308 310
309 @Override 311 @Override
310 protected void onDestroy() { 312 protected void onDestroy() {
311 disconnect(); 313 disconnect();
312 if (logToast != null) { 314 if (logToast != null) {
313 logToast.cancel(); 315 logToast.cancel();
314 } 316 }
315 activityRunning = false; 317 activityRunning = false;
316 rootEglBase.release(); 318 rootEglBase.release();
317 if (cpuMonitor != null) {
318 cpuMonitor.release();
magjed_webrtc 2016/05/19 12:07:54 don't we need to shut down the ExecutorService?
sakal 2016/05/19 12:39:03 In the new implementation, the executor is already
319 }
320 super.onDestroy(); 319 super.onDestroy();
321 } 320 }
322 321
323 // CallFragment.OnCallEvents interface implementation. 322 // CallFragment.OnCallEvents interface implementation.
324 @Override 323 @Override
325 public void onCallHangUp() { 324 public void onCallHangUp() {
326 disconnect(); 325 disconnect();
327 } 326 }
328 327
329 @Override 328 @Override
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 707 }
709 } 708 }
710 }); 709 });
711 } 710 }
712 711
713 @Override 712 @Override
714 public void onPeerConnectionError(final String description) { 713 public void onPeerConnectionError(final String description) {
715 reportError(description); 714 reportError(description);
716 } 715 }
717 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698