Index: webrtc/sdk/android/api/org/webrtc/RTCStatsReport.java |
diff --git a/webrtc/sdk/android/api/org/webrtc/RTCStatsReport.java b/webrtc/sdk/android/api/org/webrtc/RTCStatsReport.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a60d8e32504f639bd8d70d0ae8e6145081959954 |
--- /dev/null |
+++ b/webrtc/sdk/android/api/org/webrtc/RTCStatsReport.java |
@@ -0,0 +1,50 @@ |
+/* |
+ * Copyright 2017 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+package org.webrtc; |
+ |
+import java.util.SortedMap; |
+ |
+/** Java version of webrtc::RTCStatsReport. */ |
+public class RTCStatsReport { |
+ private final long timestamp_us; |
+ private final SortedMap<String, RTCStats> stats; |
+ |
+ public RTCStatsReport(long timestamp_us, SortedMap<String, RTCStats> stats) { |
+ this.timestamp_us = timestamp_us; |
hbos
2017/04/10 10:19:42
nit: timestampUs
Taylor Brandstetter
2017/04/10 23:59:33
Done (at least my mistake was consistent...)
hbos
2017/04/11 09:36:13
:)
|
+ this.stats = stats; |
+ } |
+ |
+ // Timestamp in nanoseconds. |
+ public double timestamp_us() { |
+ return timestamp_us; |
+ } |
+ |
+ // Map of stats object IDs to stats objects. Can be used to easily look up |
+ // other stats objects, when they refer to each other by ID. |
+ public SortedMap<String, RTCStats> stats() { |
+ return stats; |
+ } |
+ |
+ public String toString() { |
+ StringBuilder builder = new StringBuilder(); |
+ builder.append("{ timestamp_us: ").append(timestamp_us).append(", stats: [\n"); |
+ boolean first = true; |
+ for (RTCStats stat : stats.values()) { |
+ if (!first) { |
+ builder.append(",\n"); |
+ } |
+ builder.append(stat.toString()); |
hbos
2017/04/10 10:19:42
nit: append(stat)
Taylor Brandstetter
2017/04/10 23:59:33
Done.
|
+ first = false; |
+ } |
+ builder.append(" ] }"); |
+ return builder.toString(); |
+ } |
+} |