OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 template<typename T> | 74 template<typename T> |
75 std::vector<const T*> GetStatsOfType() const { | 75 std::vector<const T*> GetStatsOfType() const { |
76 std::vector<const T*> stats_of_type; | 76 std::vector<const T*> stats_of_type; |
77 for (const RTCStats& stats : *this) { | 77 for (const RTCStats& stats : *this) { |
78 if (stats.type() == T::kType) | 78 if (stats.type() == T::kType) |
79 stats_of_type.push_back(&stats.cast_to<const T>()); | 79 stats_of_type.push_back(&stats.cast_to<const T>()); |
80 } | 80 } |
81 return stats_of_type; | 81 return stats_of_type; |
82 } | 82 } |
83 | 83 |
84 // Creates a human readable string representation of the report, listing all | 84 // Creates a JSON readable string representation of the report, |
85 // of its stats objects. | 85 // listing all of its stats objects. |
86 std::string ToString() const; | 86 std::string ToJson() const; |
87 | 87 |
88 friend class rtc::RefCountedObject<RTCStatsReport>; | 88 friend class rtc::RefCountedObject<RTCStatsReport>; |
89 | 89 |
90 private: | 90 private: |
91 ~RTCStatsReport() override; | 91 ~RTCStatsReport() override; |
92 | 92 |
93 int64_t timestamp_us_; | 93 int64_t timestamp_us_; |
94 StatsMap stats_; | 94 StatsMap stats_; |
95 }; | 95 }; |
96 | 96 |
97 } // namespace webrtc | 97 } // namespace webrtc |
98 | 98 |
99 #endif // WEBRTC_API_STATS_RTCSTATSREPORT_H_ | 99 #endif // WEBRTC_API_STATS_RTCSTATSREPORT_H_ |
OLD | NEW |