Index: webrtc/api/stats/rtcstats.h |
diff --git a/webrtc/api/stats/rtcstats.h b/webrtc/api/stats/rtcstats.h |
index 6730672012abd919b088d0a7bbf6341d4c50796c..d9ed7bc2f6df2601f531c28d9c7cc937ba4f5c0a 100644 |
--- a/webrtc/api/stats/rtcstats.h |
+++ b/webrtc/api/stats/rtcstats.h |
@@ -72,9 +72,9 @@ class RTCStats { |
bool operator==(const RTCStats& other) const; |
bool operator!=(const RTCStats& other) const; |
- // Creates a human readable string representation of the stats object, listing |
- // all of its members (names and values). |
- std::string ToString() const; |
+ // Creates a JSON readable string representation of the stats |
+ // object, listing all of its members (names and values). |
+ std::string ToJson() const; |
// Downcasts the stats object to an |RTCStats| subclass |T|. DCHECKs that the |
// object is of type |T|. |
@@ -222,6 +222,12 @@ class RTCStatsMemberInterface { |
return !(*this == other); |
} |
virtual std::string ValueToString() const = 0; |
+ // This is the same as ValueToString except for kInt64 and kUint64 types, |
+ // where the value is represented as a double instead of as an integer. |
+ // Since JSON stores numbers as floating point numbers, very large integers |
+ // cannot be accurately represented, so we prefer to display them as doubles |
+ // instead. |
+ virtual std::string ValueToJson() const = 0; |
template<typename T> |
const T& cast_to() const { |
@@ -277,6 +283,7 @@ class RTCStatsMember : public RTCStatsMemberInterface { |
return value_ == other_t.value_; |
} |
std::string ValueToString() const override; |
+ std::string ValueToJson() const override; |
// Assignment operators. |
T& operator=(const T& value) { |