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

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

Issue 2377003002: Format all Java in WebRTC. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
(...skipping 23 matching lines...) Expand all
34 private TextView hudViewConnection; 34 private TextView hudViewConnection;
35 private TextView hudViewVideoSend; 35 private TextView hudViewVideoSend;
36 private TextView hudViewVideoRecv; 36 private TextView hudViewVideoRecv;
37 private ImageButton toggleDebugButton; 37 private ImageButton toggleDebugButton;
38 private boolean videoCallEnabled; 38 private boolean videoCallEnabled;
39 private boolean displayHud; 39 private boolean displayHud;
40 private volatile boolean isRunning; 40 private volatile boolean isRunning;
41 private CpuMonitor cpuMonitor; 41 private CpuMonitor cpuMonitor;
42 42
43 @Override 43 @Override
44 public View onCreateView(LayoutInflater inflater, ViewGroup container, 44 public View onCreateView(
45 Bundle savedInstanceState) { 45 LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
46 controlView = inflater.inflate(R.layout.fragment_hud, container, false); 46 controlView = inflater.inflate(R.layout.fragment_hud, container, false);
47 47
48 // Create UI controls. 48 // Create UI controls.
49 encoderStatView = (TextView) controlView.findViewById(R.id.encoder_stat_call ); 49 encoderStatView = (TextView) controlView.findViewById(R.id.encoder_stat_call );
50 hudViewBwe = (TextView) controlView.findViewById(R.id.hud_stat_bwe); 50 hudViewBwe = (TextView) controlView.findViewById(R.id.hud_stat_bwe);
51 hudViewConnection = (TextView) controlView.findViewById(R.id.hud_stat_connec tion); 51 hudViewConnection = (TextView) controlView.findViewById(R.id.hud_stat_connec tion);
52 hudViewVideoSend = (TextView) controlView.findViewById(R.id.hud_stat_video_s end); 52 hudViewVideoSend = (TextView) controlView.findViewById(R.id.hud_stat_video_s end);
53 hudViewVideoRecv = (TextView) controlView.findViewById(R.id.hud_stat_video_r ecv); 53 hudViewVideoRecv = (TextView) controlView.findViewById(R.id.hud_stat_video_r ecv);
54 toggleDebugButton = (ImageButton) controlView.findViewById(R.id.button_toggl e_debug); 54 toggleDebugButton = (ImageButton) controlView.findViewById(R.id.button_toggl e_debug);
55 55
56 toggleDebugButton.setOnClickListener(new View.OnClickListener() { 56 toggleDebugButton.setOnClickListener(new View.OnClickListener() {
57 @Override 57 @Override
58 public void onClick(View view) { 58 public void onClick(View view) {
59 if (displayHud) { 59 if (displayHud) {
60 int visibility = (hudViewBwe.getVisibility() == View.VISIBLE) 60 int visibility =
61 ? View.INVISIBLE : View.VISIBLE; 61 (hudViewBwe.getVisibility() == View.VISIBLE) ? View.INVISIBLE : Vi ew.VISIBLE;
62 hudViewsSetProperties(visibility); 62 hudViewsSetProperties(visibility);
63 } 63 }
64 } 64 }
65 }); 65 });
66 66
67 return controlView; 67 return controlView;
68 } 68 }
69 69
70 @Override 70 @Override
71 public void onStart() { 71 public void onStart() {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 StringBuilder encoderStat = new StringBuilder(128); 119 StringBuilder encoderStat = new StringBuilder(128);
120 StringBuilder bweStat = new StringBuilder(); 120 StringBuilder bweStat = new StringBuilder();
121 StringBuilder connectionStat = new StringBuilder(); 121 StringBuilder connectionStat = new StringBuilder();
122 StringBuilder videoSendStat = new StringBuilder(); 122 StringBuilder videoSendStat = new StringBuilder();
123 StringBuilder videoRecvStat = new StringBuilder(); 123 StringBuilder videoRecvStat = new StringBuilder();
124 String fps = null; 124 String fps = null;
125 String targetBitrate = null; 125 String targetBitrate = null;
126 String actualBitrate = null; 126 String actualBitrate = null;
127 127
128 for (StatsReport report : reports) { 128 for (StatsReport report : reports) {
129 if (report.type.equals("ssrc") && report.id.contains("ssrc") 129 if (report.type.equals("ssrc") && report.id.contains("ssrc") && report.id. contains("send")) {
130 && report.id.contains("send")) {
131 // Send video statistics. 130 // Send video statistics.
132 Map<String, String> reportMap = getReportMap(report); 131 Map<String, String> reportMap = getReportMap(report);
133 String trackId = reportMap.get("googTrackId"); 132 String trackId = reportMap.get("googTrackId");
134 if (trackId != null && trackId.contains(PeerConnectionClient.VIDEO_TRACK _ID)) { 133 if (trackId != null && trackId.contains(PeerConnectionClient.VIDEO_TRACK _ID)) {
135 fps = reportMap.get("googFrameRateSent"); 134 fps = reportMap.get("googFrameRateSent");
136 videoSendStat.append(report.id).append("\n"); 135 videoSendStat.append(report.id).append("\n");
137 for (StatsReport.Value value : report.values) { 136 for (StatsReport.Value value : report.values) {
138 String name = value.name.replace("goog", ""); 137 String name = value.name.replace("goog", "");
139 videoSendStat.append(name).append("=").append(value.value).append("\ n"); 138 videoSendStat.append(name).append("=").append(value.value).append("\ n");
140 } 139 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (targetBitrate != null) { 187 if (targetBitrate != null) {
189 encoderStat.append("Target BR: ").append(targetBitrate).append("\n"); 188 encoderStat.append("Target BR: ").append(targetBitrate).append("\n");
190 } 189 }
191 if (actualBitrate != null) { 190 if (actualBitrate != null) {
192 encoderStat.append("Actual BR: ").append(actualBitrate).append("\n"); 191 encoderStat.append("Actual BR: ").append(actualBitrate).append("\n");
193 } 192 }
194 } 193 }
195 194
196 if (cpuMonitor != null) { 195 if (cpuMonitor != null) {
197 encoderStat.append("CPU%: ") 196 encoderStat.append("CPU%: ")
198 .append(cpuMonitor.getCpuUsageCurrent()).append("/") 197 .append(cpuMonitor.getCpuUsageCurrent())
199 .append(cpuMonitor.getCpuUsageAverage()) 198 .append("/")
200 .append(". Freq: ").append(cpuMonitor.getFrequencyScaleAverage()); 199 .append(cpuMonitor.getCpuUsageAverage())
200 .append(". Freq: ")
201 .append(cpuMonitor.getFrequencyScaleAverage());
201 } 202 }
202 encoderStatView.setText(encoderStat.toString()); 203 encoderStatView.setText(encoderStat.toString());
203 } 204 }
204 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698