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

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

Issue 1813053007: Update CPU Monitor to report CPU frequency and battery level. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Address comment Created 4 years, 9 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/CpuMonitor.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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 private int runTimeMs; 127 private int runTimeMs;
128 private boolean activityRunning; 128 private boolean activityRunning;
129 private RoomConnectionParameters roomConnectionParameters; 129 private RoomConnectionParameters roomConnectionParameters;
130 private PeerConnectionParameters peerConnectionParameters; 130 private PeerConnectionParameters peerConnectionParameters;
131 private boolean iceConnected; 131 private boolean iceConnected;
132 private boolean isError; 132 private boolean isError;
133 private boolean callControlFragmentVisible = true; 133 private boolean callControlFragmentVisible = true;
134 private long callStartedTimeMs = 0; 134 private long callStartedTimeMs = 0;
135 135
136 // Controls 136 // Controls
137 CallFragment callFragment; 137 private CallFragment callFragment;
138 HudFragment hudFragment; 138 private HudFragment hudFragment;
139 private CpuMonitor cpuMonitor;
140
139 141
140 @Override 142 @Override
141 public void onCreate(Bundle savedInstanceState) { 143 public void onCreate(Bundle savedInstanceState) {
142 super.onCreate(savedInstanceState); 144 super.onCreate(savedInstanceState);
143 Thread.setDefaultUncaughtExceptionHandler( 145 Thread.setDefaultUncaughtExceptionHandler(
144 new UnhandledExceptionHandler(this)); 146 new UnhandledExceptionHandler(this));
145 147
146 // Set window styles for fullscreen-window size. Needs to be done before 148 // Set window styles for fullscreen-window size. Needs to be done before
147 // adding content. 149 // adding content.
148 requestWindowFeature(Window.FEATURE_NO_TITLE); 150 requestWindowFeature(Window.FEATURE_NO_TITLE);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false), 237 intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false),
236 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false)); 238 intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false));
237 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); 239 commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
238 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); 240 runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
239 241
240 // Create connection client and connection parameters. 242 // Create connection client and connection parameters.
241 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor()); 243 appRtcClient = new WebSocketRTCClient(this, new LooperExecutor());
242 roomConnectionParameters = new RoomConnectionParameters( 244 roomConnectionParameters = new RoomConnectionParameters(
243 roomUri.toString(), roomId, loopback); 245 roomUri.toString(), roomId, loopback);
244 246
247 // Create CPU monitor
248 cpuMonitor = new CpuMonitor(this);
249 hudFragment.setCpuMonitor(cpuMonitor);
250
245 // Send intent arguments to fragments. 251 // Send intent arguments to fragments.
246 callFragment.setArguments(intent.getExtras()); 252 callFragment.setArguments(intent.getExtras());
247 hudFragment.setArguments(intent.getExtras()); 253 hudFragment.setArguments(intent.getExtras());
248 // Activate call and HUD fragments and start the call. 254 // Activate call and HUD fragments and start the call.
249 FragmentTransaction ft = getFragmentManager().beginTransaction(); 255 FragmentTransaction ft = getFragmentManager().beginTransaction();
250 ft.add(R.id.call_fragment_container, callFragment); 256 ft.add(R.id.call_fragment_container, callFragment);
251 ft.add(R.id.hud_fragment_container, hudFragment); 257 ft.add(R.id.hud_fragment_container, hudFragment);
252 ft.commit(); 258 ft.commit();
253 startCall(); 259 startCall();
254 260
(...skipping 18 matching lines...) Expand all
273 } 279 }
274 280
275 // Activity interfaces 281 // Activity interfaces
276 @Override 282 @Override
277 public void onPause() { 283 public void onPause() {
278 super.onPause(); 284 super.onPause();
279 activityRunning = false; 285 activityRunning = false;
280 if (peerConnectionClient != null) { 286 if (peerConnectionClient != null) {
281 peerConnectionClient.stopVideoSource(); 287 peerConnectionClient.stopVideoSource();
282 } 288 }
289 cpuMonitor.pause();
283 } 290 }
284 291
285 @Override 292 @Override
286 public void onResume() { 293 public void onResume() {
287 super.onResume(); 294 super.onResume();
288 activityRunning = true; 295 activityRunning = true;
289 if (peerConnectionClient != null) { 296 if (peerConnectionClient != null) {
290 peerConnectionClient.startVideoSource(); 297 peerConnectionClient.startVideoSource();
291 } 298 }
299 cpuMonitor.resume();
292 } 300 }
293 301
294 @Override 302 @Override
295 protected void onDestroy() { 303 protected void onDestroy() {
296 disconnect(); 304 disconnect();
297 if (logToast != null) { 305 if (logToast != null) {
298 logToast.cancel(); 306 logToast.cancel();
299 } 307 }
300 activityRunning = false; 308 activityRunning = false;
301 rootEglBase.release(); 309 rootEglBase.release();
310 cpuMonitor.release();
302 super.onDestroy(); 311 super.onDestroy();
303 } 312 }
304 313
305 // CallFragment.OnCallEvents interface implementation. 314 // CallFragment.OnCallEvents interface implementation.
306 @Override 315 @Override
307 public void onCallHangUp() { 316 public void onCallHangUp() {
308 disconnect(); 317 disconnect();
309 } 318 }
310 319
311 @Override 320 @Override
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 } 690 }
682 } 691 }
683 }); 692 });
684 } 693 }
685 694
686 @Override 695 @Override
687 public void onPeerConnectionError(final String description) { 696 public void onPeerConnectionError(final String description) {
688 reportError(description); 697 reportError(description);
689 } 698 }
690 } 699 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/examples/androidapp/src/org/appspot/apprtc/CpuMonitor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698