Active connection stats [LocalAddress,RemoteAddress,LocalCandidateType...etc]
is now printed in the head-up display in Android appRTC.
This printing will be usefull in debugging switching ICE candidates.
R=andresp@webrtc.org, glaznev@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/13189005
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@6927 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
index ef97cda..213da7b 100644
--- a/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
+++ b/examples/android/src/org/appspot/apprtc/AppRTCDemoActivity.java
@@ -200,19 +200,49 @@
private void updateHUD(StatsReport[] reports) {
StringBuilder builder = new StringBuilder();
for (StatsReport report : reports) {
- if (!report.id.equals("bweforvideo")) {
+ // bweforvideo to show statistics for video Bandwidth Estimation,
+ // which is global per-session.
+ if (report.id.equals("bweforvideo")) {
+ for (StatsReport.Value value : report.values) {
+ String name = value.name.replace("goog", "")
+ .replace("Available", "").replace("Bandwidth", "")
+ .replace("Bitrate", "").replace("Enc", "");
+
+ builder.append(name).append("=").append(value.value)
+ .append(" ");
+ }
+ builder.append("\n");
+ } else if (report.type.equals("googCandidatePair")) {
+ String activeConnectionStats = getActiveConnectionStats(report);
+ if (activeConnectionStats == null) {
+ continue;
+ }
+ builder.append(activeConnectionStats);
+ } else {
continue;
}
- for (StatsReport.Value value : report.values) {
- String name = value.name.replace("goog", "").replace("Available", "")
- .replace("Bandwidth", "").replace("Bitrate", "").replace("Enc", "");
- builder.append(name).append("=").append(value.value).append(" ");
- }
builder.append("\n");
}
hudView.setText(builder.toString() + hudView.getText());
}
+ // Return the active connection stats else return null
+ private String getActiveConnectionStats(StatsReport report) {
+ StringBuilder activeConnectionbuilder = new StringBuilder();
+ // googCandidatePair to show information about the active
+ // connection.
+ for (StatsReport.Value value : report.values) {
+ if (value.name.equals("googActiveConnection")
+ && value.value.equals("false")) {
+ return null;
+ }
+ String name = value.name.replace("goog", "");
+ activeConnectionbuilder.append(name).append("=")
+ .append(value.value).append("\n");
+ }
+ return activeConnectionbuilder.toString();
+ }
+
@Override
public void onPause() {
super.onPause();