hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef API_STATS_RTC_STATS_H_ |
| 12 | #define API_STATS_RTC_STATS_H_ |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 13 | |
Yves Gerey | 3e70781 | 2018-11-28 16:47:49 +0100 | [diff] [blame] | 14 | #include <stddef.h> |
| 15 | #include <stdint.h> |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 16 | |
Byoungchan Lee | 0a52ede | 2021-05-22 08:41:02 +0900 | [diff] [blame] | 17 | #include <map> |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 18 | #include <memory> |
| 19 | #include <string> |
| 20 | #include <utility> |
| 21 | #include <vector> |
| 22 | |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 23 | #include "absl/types/optional.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 24 | #include "rtc_base/checks.h" |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 25 | #include "rtc_base/system/rtc_export.h" |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 26 | #include "rtc_base/system/rtc_export_template.h" |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 27 | |
| 28 | namespace webrtc { |
| 29 | |
| 30 | class RTCStatsMemberInterface; |
| 31 | |
| 32 | // Abstract base class for RTCStats-derived dictionaries, see |
| 33 | // https://w3c.github.io/webrtc-stats/. |
| 34 | // |
| 35 | // All derived classes must have the following static variable defined: |
| 36 | // static const char kType[]; |
| 37 | // It is used as a unique class identifier and a string representation of the |
| 38 | // class type, see https://w3c.github.io/webrtc-stats/#rtcstatstype-str*. |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 39 | // Use the `WEBRTC_RTCSTATS_IMPL` macro when implementing subclasses, see macro |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 40 | // for details. |
| 41 | // |
| 42 | // Derived classes list their dictionary members, RTCStatsMember<T>, as public |
| 43 | // fields, allowing the following: |
| 44 | // |
| 45 | // RTCFooStats foo("fooId", GetCurrentTime()); |
| 46 | // foo.bar = 42; |
| 47 | // foo.baz = std::vector<std::string>(); |
| 48 | // foo.baz->push_back("hello world"); |
| 49 | // uint32_t x = *foo.bar; |
| 50 | // |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 51 | // Pointers to all the members are available with `Members`, allowing iteration: |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 52 | // |
| 53 | // for (const RTCStatsMemberInterface* member : foo.Members()) { |
| 54 | // printf("%s = %s\n", member->name(), member->ValueToString().c_str()); |
| 55 | // } |
Mirko Bonadei | 276827c | 2018-10-16 14:13:50 +0200 | [diff] [blame] | 56 | class RTC_EXPORT RTCStats { |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 57 | public: |
| 58 | RTCStats(const std::string& id, int64_t timestamp_us) |
| 59 | : id_(id), timestamp_us_(timestamp_us) {} |
| 60 | RTCStats(std::string&& id, int64_t timestamp_us) |
| 61 | : id_(std::move(id)), timestamp_us_(timestamp_us) {} |
| 62 | virtual ~RTCStats() {} |
| 63 | |
| 64 | virtual std::unique_ptr<RTCStats> copy() const = 0; |
| 65 | |
| 66 | const std::string& id() const { return id_; } |
| 67 | // Time relative to the UNIX epoch (Jan 1, 1970, UTC), in microseconds. |
| 68 | int64_t timestamp_us() const { return timestamp_us_; } |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 69 | // Returns the static member variable `kType` of the implementing class. |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 70 | virtual const char* type() const = 0; |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 71 | // Returns a vector of pointers to all the `RTCStatsMemberInterface` members |
hbos | 67c8bc4 | 2016-10-25 04:31:23 -0700 | [diff] [blame] | 72 | // of this class. This allows for iteration of members. For a given class, |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 73 | // `Members` always returns the same members in the same order. |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 74 | std::vector<const RTCStatsMemberInterface*> Members() const; |
hbos | 67c8bc4 | 2016-10-25 04:31:23 -0700 | [diff] [blame] | 75 | // Checks if the two stats objects are of the same type and have the same |
hbos | 0583b28 | 2016-11-30 01:50:14 -0800 | [diff] [blame] | 76 | // member values. Timestamps are not compared. These operators are exposed for |
| 77 | // testing. |
hbos | 67c8bc4 | 2016-10-25 04:31:23 -0700 | [diff] [blame] | 78 | bool operator==(const RTCStats& other) const; |
| 79 | bool operator!=(const RTCStats& other) const; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 80 | |
ehmaldonado | 35a872c | 2017-07-28 07:29:12 -0700 | [diff] [blame] | 81 | // Creates a JSON readable string representation of the stats |
| 82 | // object, listing all of its members (names and values). |
| 83 | std::string ToJson() const; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 84 | |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 85 | // Downcasts the stats object to an `RTCStats` subclass `T`. DCHECKs that the |
| 86 | // object is of type `T`. |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 87 | template <typename T> |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 88 | const T& cast_to() const { |
| 89 | RTC_DCHECK_EQ(type(), T::kType); |
| 90 | return static_cast<const T&>(*this); |
| 91 | } |
| 92 | |
| 93 | protected: |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 94 | // Gets a vector of all members of this `RTCStats` object, including members |
| 95 | // derived from parent classes. `additional_capacity` is how many more members |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 96 | // shall be reserved in the vector (so that subclasses can allocate a vector |
| 97 | // with room for both parent and child members without it having to resize). |
| 98 | virtual std::vector<const RTCStatsMemberInterface*> |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 99 | MembersOfThisObjectAndAncestors(size_t additional_capacity) const; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 100 | |
| 101 | std::string const id_; |
| 102 | int64_t timestamp_us_; |
| 103 | }; |
| 104 | |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 105 | // All `RTCStats` classes should use these macros. |
| 106 | // `WEBRTC_RTCSTATS_DECL` is placed in a public section of the class definition. |
| 107 | // `WEBRTC_RTCSTATS_IMPL` is placed outside the class definition (in a .cc). |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 108 | // |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 109 | // These macros declare (in _DECL) and define (in _IMPL) the static `kType` and |
| 110 | // overrides methods as required by subclasses of `RTCStats`: `copy`, `type` and |
| 111 | // `MembersOfThisObjectAndAncestors`. The |...| argument is a list of addresses |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 112 | // to each member defined in the implementing class. The list must have at least |
| 113 | // one member. |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 114 | // |
| 115 | // (Since class names need to be known to implement these methods this cannot be |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 116 | // part of the base `RTCStats`. While these methods could be implemented using |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 117 | // templates, that would only work for immediate subclasses. Subclasses of |
| 118 | // subclasses also have to override these methods, resulting in boilerplate |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 119 | // code. Using a macro avoids this and works for any `RTCStats` class, including |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 120 | // grandchildren.) |
| 121 | // |
| 122 | // Sample usage: |
| 123 | // |
| 124 | // rtcfoostats.h: |
| 125 | // class RTCFooStats : public RTCStats { |
| 126 | // public: |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 127 | // WEBRTC_RTCSTATS_DECL(); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 128 | // |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 129 | // RTCFooStats(const std::string& id, int64_t timestamp_us); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 130 | // |
| 131 | // RTCStatsMember<int32_t> foo; |
| 132 | // RTCStatsMember<int32_t> bar; |
| 133 | // }; |
| 134 | // |
| 135 | // rtcfoostats.cc: |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 136 | // WEBRTC_RTCSTATS_IMPL(RTCFooStats, RTCStats, "foo-stats" |
| 137 | // &foo, |
| 138 | // &bar); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 139 | // |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 140 | // RTCFooStats::RTCFooStats(const std::string& id, int64_t timestamp_us) |
| 141 | // : RTCStats(id, timestamp_us), |
| 142 | // foo("foo"), |
| 143 | // bar("bar") { |
| 144 | // } |
| 145 | // |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 146 | #define WEBRTC_RTCSTATS_DECL() \ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 147 | protected: \ |
| 148 | std::vector<const webrtc::RTCStatsMemberInterface*> \ |
| 149 | MembersOfThisObjectAndAncestors(size_t local_var_additional_capacity) \ |
| 150 | const override; \ |
| 151 | \ |
Nico Weber | 22f9925 | 2019-02-20 10:13:16 -0500 | [diff] [blame] | 152 | public: \ |
| 153 | static const char kType[]; \ |
| 154 | \ |
| 155 | std::unique_ptr<webrtc::RTCStats> copy() const override; \ |
| 156 | const char* type() const override |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 157 | |
| 158 | #define WEBRTC_RTCSTATS_IMPL(this_class, parent_class, type_str, ...) \ |
| 159 | const char this_class::kType[] = type_str; \ |
| 160 | \ |
| 161 | std::unique_ptr<webrtc::RTCStats> this_class::copy() const { \ |
Philipp Hancke | b5cf12d | 2022-09-06 11:55:31 +0200 | [diff] [blame] | 162 | return std::make_unique<this_class>(*this); \ |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 163 | } \ |
| 164 | \ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 165 | const char* this_class::type() const { return this_class::kType; } \ |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 166 | \ |
| 167 | std::vector<const webrtc::RTCStatsMemberInterface*> \ |
| 168 | this_class::MembersOfThisObjectAndAncestors( \ |
| 169 | size_t local_var_additional_capacity) const { \ |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 170 | const webrtc::RTCStatsMemberInterface* local_var_members[] = { \ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 171 | __VA_ARGS__}; \ |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 172 | size_t local_var_members_count = \ |
| 173 | sizeof(local_var_members) / sizeof(local_var_members[0]); \ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 174 | std::vector<const webrtc::RTCStatsMemberInterface*> \ |
| 175 | local_var_members_vec = parent_class::MembersOfThisObjectAndAncestors( \ |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 176 | local_var_members_count + local_var_additional_capacity); \ |
| 177 | RTC_DCHECK_GE( \ |
| 178 | local_var_members_vec.capacity() - local_var_members_vec.size(), \ |
| 179 | local_var_members_count + local_var_additional_capacity); \ |
| 180 | local_var_members_vec.insert(local_var_members_vec.end(), \ |
| 181 | &local_var_members[0], \ |
| 182 | &local_var_members[local_var_members_count]); \ |
| 183 | return local_var_members_vec; \ |
hbos | fc5e050 | 2016-10-06 02:06:10 -0700 | [diff] [blame] | 184 | } |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 185 | |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 186 | // A version of WEBRTC_RTCSTATS_IMPL() where "..." is omitted, used to avoid a |
| 187 | // compile error on windows. This is used if the stats dictionary does not |
| 188 | // declare any members of its own (but perhaps its parent dictionary does). |
| 189 | #define WEBRTC_RTCSTATS_IMPL_NO_MEMBERS(this_class, parent_class, type_str) \ |
| 190 | const char this_class::kType[] = type_str; \ |
| 191 | \ |
| 192 | std::unique_ptr<webrtc::RTCStats> this_class::copy() const { \ |
Philipp Hancke | b5cf12d | 2022-09-06 11:55:31 +0200 | [diff] [blame] | 193 | return std::make_unique<this_class>(*this); \ |
Henrik Boström | 646fda0 | 2019-05-22 15:49:42 +0200 | [diff] [blame] | 194 | } \ |
| 195 | \ |
| 196 | const char* this_class::type() const { return this_class::kType; } \ |
| 197 | \ |
| 198 | std::vector<const webrtc::RTCStatsMemberInterface*> \ |
| 199 | this_class::MembersOfThisObjectAndAncestors( \ |
| 200 | size_t local_var_additional_capacity) const { \ |
| 201 | return parent_class::MembersOfThisObjectAndAncestors(0); \ |
| 202 | } |
| 203 | |
Jakob Ivarsson | 2293622 | 2019-03-22 11:29:49 +0100 | [diff] [blame] | 204 | // Non-standard stats members can be exposed to the JavaScript API in Chrome |
| 205 | // e.g. through origin trials. The group ID can be used by the blink layer to |
| 206 | // determine if a stats member should be exposed or not. Multiple non-standard |
| 207 | // stats members can share the same group ID so that they are exposed together. |
| 208 | enum class NonStandardGroupId { |
Jakob Ivarsson | aa023e2 | 2019-03-27 10:17:31 +0100 | [diff] [blame] | 209 | // Group ID used for testing purposes only. |
| 210 | kGroupIdForTesting, |
Jakob Ivarsson | 2293622 | 2019-03-22 11:29:49 +0100 | [diff] [blame] | 211 | // I2E: |
| 212 | // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/hE2B1iItPDk |
| 213 | kRtcAudioJitterBufferMaxPackets, |
| 214 | // I2E: |
| 215 | // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/YbhMyqLXXXo |
| 216 | kRtcStatsRelativePacketArrivalDelay, |
| 217 | }; |
| 218 | |
Evan Shrubsole | 6c733ee | 2022-10-12 15:11:14 +0000 | [diff] [blame] | 219 | // Certain stat members should only be exposed to the JavaScript API in |
| 220 | // certain circumstances as to avoid passive fingerprinting. |
| 221 | enum class StatExposureCriteria : uint8_t { |
| 222 | // The stat should always be exposed. This is the default. |
| 223 | kAlways, |
| 224 | // The stat exposes hardware capabilities and thus should has limited exposure |
| 225 | // to JavaScript. The requirements for exposure are written in the spec at |
| 226 | // https://w3c.github.io/webrtc-stats/#limiting-exposure-of-hardware-capabilities. |
| 227 | kHardwareCapability, |
| 228 | }; |
| 229 | |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 230 | // Interface for `RTCStats` members, which have a name and a value of a type |
| 231 | // defined in a subclass. Only the types listed in `Type` are supported, these |
Artem Titov | cfea218 | 2021-08-10 01:22:31 +0200 | [diff] [blame] | 232 | // are implemented by `RTCStatsMember<T>`. The value of a member may be |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 233 | // undefined, the value can only be read if `is_defined`. |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 234 | class RTCStatsMemberInterface { |
| 235 | public: |
| 236 | // Member value types. |
| 237 | enum Type { |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 238 | kBool, // bool |
| 239 | kInt32, // int32_t |
| 240 | kUint32, // uint32_t |
| 241 | kInt64, // int64_t |
| 242 | kUint64, // uint64_t |
| 243 | kDouble, // double |
| 244 | kString, // std::string |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 245 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 246 | kSequenceBool, // std::vector<bool> |
| 247 | kSequenceInt32, // std::vector<int32_t> |
| 248 | kSequenceUint32, // std::vector<uint32_t> |
| 249 | kSequenceInt64, // std::vector<int64_t> |
| 250 | kSequenceUint64, // std::vector<uint64_t> |
| 251 | kSequenceDouble, // std::vector<double> |
| 252 | kSequenceString, // std::vector<std::string> |
Byoungchan Lee | 0a52ede | 2021-05-22 08:41:02 +0900 | [diff] [blame] | 253 | |
| 254 | kMapStringUint64, // std::map<std::string, uint64_t> |
| 255 | kMapStringDouble, // std::map<std::string, double> |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 256 | }; |
| 257 | |
| 258 | virtual ~RTCStatsMemberInterface() {} |
| 259 | |
| 260 | const char* name() const { return name_; } |
| 261 | virtual Type type() const = 0; |
| 262 | virtual bool is_sequence() const = 0; |
| 263 | virtual bool is_string() const = 0; |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 264 | virtual bool is_defined() const = 0; |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 265 | // Is this part of the stats spec? Used so that chromium can easily filter |
| 266 | // out anything unstandardized. |
| 267 | virtual bool is_standardized() const = 0; |
Jakob Ivarsson | 2293622 | 2019-03-22 11:29:49 +0100 | [diff] [blame] | 268 | // Non-standard stats members can have group IDs in order to be exposed in |
| 269 | // JavaScript through experiments. Standardized stats have no group IDs. |
| 270 | virtual std::vector<NonStandardGroupId> group_ids() const { return {}; } |
Evan Shrubsole | 6c733ee | 2022-10-12 15:11:14 +0000 | [diff] [blame] | 271 | // The conditions for exposing the statistic to JavaScript. Stats with |
| 272 | // criteria that is not kAlways has some restriction and should be filtered |
| 273 | // in accordance to the spec. |
| 274 | virtual StatExposureCriteria exposure_criteria() const { |
| 275 | return StatExposureCriteria::kAlways; |
| 276 | } |
hbos | 67c8bc4 | 2016-10-25 04:31:23 -0700 | [diff] [blame] | 277 | // Type and value comparator. The names are not compared. These operators are |
| 278 | // exposed for testing. |
Byoungchan Lee | 8c4601b | 2022-09-23 13:59:42 +0900 | [diff] [blame] | 279 | bool operator==(const RTCStatsMemberInterface& other) const { |
| 280 | return IsEqual(other); |
| 281 | } |
hbos | 67c8bc4 | 2016-10-25 04:31:23 -0700 | [diff] [blame] | 282 | bool operator!=(const RTCStatsMemberInterface& other) const { |
| 283 | return !(*this == other); |
| 284 | } |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 285 | virtual std::string ValueToString() const = 0; |
ehmaldonado | 35a872c | 2017-07-28 07:29:12 -0700 | [diff] [blame] | 286 | // This is the same as ValueToString except for kInt64 and kUint64 types, |
| 287 | // where the value is represented as a double instead of as an integer. |
| 288 | // Since JSON stores numbers as floating point numbers, very large integers |
| 289 | // cannot be accurately represented, so we prefer to display them as doubles |
| 290 | // instead. |
| 291 | virtual std::string ValueToJson() const = 0; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 292 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 293 | template <typename T> |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 294 | const T& cast_to() const { |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 295 | RTC_DCHECK_EQ(type(), T::StaticType()); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 296 | return static_cast<const T&>(*this); |
| 297 | } |
| 298 | |
| 299 | protected: |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 300 | explicit RTCStatsMemberInterface(const char* name) : name_(name) {} |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 301 | |
Byoungchan Lee | 8c4601b | 2022-09-23 13:59:42 +0900 | [diff] [blame] | 302 | virtual bool IsEqual(const RTCStatsMemberInterface& other) const = 0; |
| 303 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 304 | const char* const name_; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 305 | }; |
| 306 | |
Artem Titov | 0e61fdd | 2021-07-25 21:50:14 +0200 | [diff] [blame] | 307 | // Template implementation of `RTCStatsMemberInterface`. |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 308 | // The supported types are the ones described by |
Artem Titov | cfea218 | 2021-08-10 01:22:31 +0200 | [diff] [blame] | 309 | // `RTCStatsMemberInterface::Type`. |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 310 | template <typename T> |
Mirko Bonadei | 1e6aa1f | 2019-11-05 17:20:58 +0100 | [diff] [blame] | 311 | class RTCStatsMember : public RTCStatsMemberInterface { |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 312 | public: |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 313 | explicit RTCStatsMember(const char* name) |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 314 | : RTCStatsMemberInterface(name), value_() {} |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 315 | RTCStatsMember(const char* name, const T& value) |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 316 | : RTCStatsMemberInterface(name), value_(value) {} |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 317 | RTCStatsMember(const char* name, T&& value) |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 318 | : RTCStatsMemberInterface(name), value_(std::move(value)) {} |
| 319 | explicit RTCStatsMember(const RTCStatsMember<T>& other) |
| 320 | : RTCStatsMemberInterface(other.name_), value_(other.value_) {} |
| 321 | explicit RTCStatsMember(RTCStatsMember<T>&& other) |
| 322 | : RTCStatsMemberInterface(other.name_), value_(std::move(other.value_)) {} |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 323 | |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 324 | static Type StaticType(); |
| 325 | Type type() const override { return StaticType(); } |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 326 | bool is_sequence() const override; |
| 327 | bool is_string() const override; |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 328 | bool is_defined() const override { return value_.has_value(); } |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 329 | bool is_standardized() const override { return true; } |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 330 | std::string ValueToString() const override; |
ehmaldonado | 35a872c | 2017-07-28 07:29:12 -0700 | [diff] [blame] | 331 | std::string ValueToJson() const override; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 332 | |
Andrey Logvin | 1f0f59f | 2020-06-15 12:49:25 +0000 | [diff] [blame] | 333 | template <typename U> |
| 334 | inline T ValueOrDefault(U default_value) const { |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 335 | return value_.value_or(default_value); |
Andrey Logvin | 1f0f59f | 2020-06-15 12:49:25 +0000 | [diff] [blame] | 336 | } |
| 337 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 338 | // Assignment operators. |
| 339 | T& operator=(const T& value) { |
| 340 | value_ = value; |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 341 | return value_.value(); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 342 | } |
| 343 | T& operator=(const T&& value) { |
| 344 | value_ = std::move(value); |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 345 | return value_.value(); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 346 | } |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 347 | |
| 348 | // Value getters. |
| 349 | T& operator*() { |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 350 | RTC_DCHECK(value_); |
| 351 | return *value_; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 352 | } |
| 353 | const T& operator*() const { |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 354 | RTC_DCHECK(value_); |
| 355 | return *value_; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 356 | } |
| 357 | |
| 358 | // Value getters, arrow operator. |
| 359 | T* operator->() { |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 360 | RTC_DCHECK(value_); |
| 361 | return &(*value_); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 362 | } |
| 363 | const T* operator->() const { |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 364 | RTC_DCHECK(value_); |
| 365 | return &(*value_); |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Byoungchan Lee | 8c4601b | 2022-09-23 13:59:42 +0900 | [diff] [blame] | 368 | protected: |
| 369 | bool IsEqual(const RTCStatsMemberInterface& other) const override { |
Evan Shrubsole | 6c733ee | 2022-10-12 15:11:14 +0000 | [diff] [blame] | 370 | if (type() != other.type() || |
| 371 | is_standardized() != other.is_standardized() || |
| 372 | exposure_criteria() != other.exposure_criteria()) |
Byoungchan Lee | 8c4601b | 2022-09-23 13:59:42 +0900 | [diff] [blame] | 373 | return false; |
| 374 | const RTCStatsMember<T>& other_t = |
| 375 | static_cast<const RTCStatsMember<T>&>(other); |
Byoungchan Lee | 8c4601b | 2022-09-23 13:59:42 +0900 | [diff] [blame] | 376 | return value_ == other_t.value_; |
| 377 | } |
| 378 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 379 | private: |
Philipp Hancke | 8e7a105 | 2022-10-13 13:14:01 +0200 | [diff] [blame^] | 380 | absl::optional<T> value_; |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 381 | }; |
| 382 | |
Byoungchan Lee | 0a52ede | 2021-05-22 08:41:02 +0900 | [diff] [blame] | 383 | namespace rtc_stats_internal { |
| 384 | |
| 385 | typedef std::map<std::string, uint64_t> MapStringUint64; |
| 386 | typedef std::map<std::string, double> MapStringDouble; |
| 387 | |
| 388 | } // namespace rtc_stats_internal |
| 389 | |
Mirko Bonadei | 62a19d0 | 2019-11-11 19:59:54 +0100 | [diff] [blame] | 390 | #define WEBRTC_DECLARE_RTCSTATSMEMBER(T) \ |
| 391 | template <> \ |
| 392 | RTC_EXPORT RTCStatsMemberInterface::Type RTCStatsMember<T>::StaticType(); \ |
| 393 | template <> \ |
Mirko Bonadei | 6dd488b | 2019-11-20 14:06:39 +0100 | [diff] [blame] | 394 | RTC_EXPORT bool RTCStatsMember<T>::is_sequence() const; \ |
Mirko Bonadei | 62a19d0 | 2019-11-11 19:59:54 +0100 | [diff] [blame] | 395 | template <> \ |
Mirko Bonadei | 6dd488b | 2019-11-20 14:06:39 +0100 | [diff] [blame] | 396 | RTC_EXPORT bool RTCStatsMember<T>::is_string() const; \ |
Mirko Bonadei | 62a19d0 | 2019-11-11 19:59:54 +0100 | [diff] [blame] | 397 | template <> \ |
Mirko Bonadei | 6dd488b | 2019-11-20 14:06:39 +0100 | [diff] [blame] | 398 | RTC_EXPORT std::string RTCStatsMember<T>::ValueToString() const; \ |
Mirko Bonadei | 62a19d0 | 2019-11-11 19:59:54 +0100 | [diff] [blame] | 399 | template <> \ |
Mirko Bonadei | 6dd488b | 2019-11-20 14:06:39 +0100 | [diff] [blame] | 400 | RTC_EXPORT std::string RTCStatsMember<T>::ValueToJson() const; \ |
Mirko Bonadei | 62a19d0 | 2019-11-11 19:59:54 +0100 | [diff] [blame] | 401 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) \ |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 402 | RTCStatsMember<T> |
| 403 | |
| 404 | WEBRTC_DECLARE_RTCSTATSMEMBER(bool); |
| 405 | WEBRTC_DECLARE_RTCSTATSMEMBER(int32_t); |
| 406 | WEBRTC_DECLARE_RTCSTATSMEMBER(uint32_t); |
| 407 | WEBRTC_DECLARE_RTCSTATSMEMBER(int64_t); |
| 408 | WEBRTC_DECLARE_RTCSTATSMEMBER(uint64_t); |
| 409 | WEBRTC_DECLARE_RTCSTATSMEMBER(double); |
| 410 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::string); |
| 411 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<bool>); |
| 412 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int32_t>); |
| 413 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint32_t>); |
| 414 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<int64_t>); |
| 415 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<uint64_t>); |
| 416 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<double>); |
| 417 | WEBRTC_DECLARE_RTCSTATSMEMBER(std::vector<std::string>); |
Byoungchan Lee | 0a52ede | 2021-05-22 08:41:02 +0900 | [diff] [blame] | 418 | WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringUint64); |
| 419 | WEBRTC_DECLARE_RTCSTATSMEMBER(rtc_stats_internal::MapStringDouble); |
Mirko Bonadei | 054f185 | 2019-11-04 16:31:08 +0100 | [diff] [blame] | 420 | |
Evan Shrubsole | 6c733ee | 2022-10-12 15:11:14 +0000 | [diff] [blame] | 421 | // For stats with restricted exposure. |
| 422 | template <typename T, StatExposureCriteria E> |
| 423 | class RTCRestrictedStatsMember : public RTCStatsMember<T> { |
| 424 | public: |
| 425 | explicit RTCRestrictedStatsMember(const char* name) |
| 426 | : RTCStatsMember<T>(name) {} |
| 427 | RTCRestrictedStatsMember(const char* name, const T& value) |
| 428 | : RTCStatsMember<T>(name, value) {} |
| 429 | RTCRestrictedStatsMember(const char* name, T&& value) |
| 430 | : RTCStatsMember<T>(name, std::move(value)) {} |
| 431 | RTCRestrictedStatsMember(const RTCRestrictedStatsMember<T, E>& other) |
| 432 | : RTCStatsMember<T>(other) {} |
| 433 | RTCRestrictedStatsMember(RTCRestrictedStatsMember<T, E>&& other) |
| 434 | : RTCStatsMember<T>(std::move(other)) {} |
| 435 | |
| 436 | StatExposureCriteria exposure_criteria() const override { return E; } |
| 437 | |
| 438 | T& operator=(const T& value) { return RTCStatsMember<T>::operator=(value); } |
| 439 | T& operator=(const T&& value) { |
| 440 | return RTCStatsMember<T>::operator=(std::move(value)); |
| 441 | } |
| 442 | |
| 443 | private: |
| 444 | static_assert(E != StatExposureCriteria::kAlways, |
| 445 | "kAlways is the default exposure criteria. Use " |
| 446 | "RTCStatMember<T> instead."); |
| 447 | }; |
| 448 | |
| 449 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 450 | RTCRestrictedStatsMember<bool, StatExposureCriteria::kHardwareCapability>; |
| 451 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 452 | RTCRestrictedStatsMember<int32_t, |
| 453 | StatExposureCriteria::kHardwareCapability>; |
| 454 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 455 | RTCRestrictedStatsMember<uint32_t, |
| 456 | StatExposureCriteria::kHardwareCapability>; |
| 457 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 458 | RTCRestrictedStatsMember<int64_t, |
| 459 | StatExposureCriteria::kHardwareCapability>; |
| 460 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 461 | RTCRestrictedStatsMember<uint64_t, |
| 462 | StatExposureCriteria::kHardwareCapability>; |
| 463 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 464 | RTCRestrictedStatsMember<double, StatExposureCriteria::kHardwareCapability>; |
| 465 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 466 | RTCRestrictedStatsMember<std::string, |
| 467 | StatExposureCriteria::kHardwareCapability>; |
| 468 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 469 | RTCRestrictedStatsMember<std::vector<bool>, |
| 470 | StatExposureCriteria::kHardwareCapability>; |
| 471 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 472 | RTCRestrictedStatsMember<std::vector<int32_t>, |
| 473 | StatExposureCriteria::kHardwareCapability>; |
| 474 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 475 | RTCRestrictedStatsMember<std::vector<uint32_t>, |
| 476 | StatExposureCriteria::kHardwareCapability>; |
| 477 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 478 | RTCRestrictedStatsMember<std::vector<int64_t>, |
| 479 | StatExposureCriteria::kHardwareCapability>; |
| 480 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 481 | RTCRestrictedStatsMember<std::vector<uint64_t>, |
| 482 | StatExposureCriteria::kHardwareCapability>; |
| 483 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 484 | RTCRestrictedStatsMember<std::vector<double>, |
| 485 | StatExposureCriteria::kHardwareCapability>; |
| 486 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 487 | RTCRestrictedStatsMember<std::vector<std::string>, |
| 488 | StatExposureCriteria::kHardwareCapability>; |
| 489 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 490 | RTCRestrictedStatsMember<std::map<std::string, uint64_t>, |
| 491 | StatExposureCriteria::kHardwareCapability>; |
| 492 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 493 | RTCRestrictedStatsMember<std::map<std::string, double>, |
| 494 | StatExposureCriteria::kHardwareCapability>; |
| 495 | |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 496 | // Using inheritance just so that it's obvious from the member's declaration |
| 497 | // whether it's standardized or not. |
| 498 | template <typename T> |
Mirko Bonadei | 759f161 | 2019-11-13 11:18:31 +0100 | [diff] [blame] | 499 | class RTCNonStandardStatsMember : public RTCStatsMember<T> { |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 500 | public: |
| 501 | explicit RTCNonStandardStatsMember(const char* name) |
| 502 | : RTCStatsMember<T>(name) {} |
Jakob Ivarsson | 758d946 | 2019-03-19 15:38:49 +0100 | [diff] [blame] | 503 | RTCNonStandardStatsMember(const char* name, |
| 504 | std::initializer_list<NonStandardGroupId> group_ids) |
| 505 | : RTCStatsMember<T>(name), group_ids_(group_ids) {} |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 506 | RTCNonStandardStatsMember(const char* name, const T& value) |
| 507 | : RTCStatsMember<T>(name, value) {} |
| 508 | RTCNonStandardStatsMember(const char* name, T&& value) |
| 509 | : RTCStatsMember<T>(name, std::move(value)) {} |
| 510 | explicit RTCNonStandardStatsMember(const RTCNonStandardStatsMember<T>& other) |
Jakob Ivarsson | 758d946 | 2019-03-19 15:38:49 +0100 | [diff] [blame] | 511 | : RTCStatsMember<T>(other), group_ids_(other.group_ids_) {} |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 512 | explicit RTCNonStandardStatsMember(RTCNonStandardStatsMember<T>&& other) |
Mirko Bonadei | 759f161 | 2019-11-13 11:18:31 +0100 | [diff] [blame] | 513 | : RTCStatsMember<T>(std::move(other)), |
| 514 | group_ids_(std::move(other.group_ids_)) {} |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 515 | |
| 516 | bool is_standardized() const override { return false; } |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 517 | |
Jakob Ivarsson | 2293622 | 2019-03-22 11:29:49 +0100 | [diff] [blame] | 518 | std::vector<NonStandardGroupId> group_ids() const override { |
| 519 | return group_ids_; |
| 520 | } |
Jakob Ivarsson | 758d946 | 2019-03-19 15:38:49 +0100 | [diff] [blame] | 521 | |
Ruslan Burakov | 8af8896 | 2018-11-22 17:21:10 +0100 | [diff] [blame] | 522 | T& operator=(const T& value) { return RTCStatsMember<T>::operator=(value); } |
| 523 | T& operator=(const T&& value) { |
| 524 | return RTCStatsMember<T>::operator=(std::move(value)); |
| 525 | } |
Jakob Ivarsson | 758d946 | 2019-03-19 15:38:49 +0100 | [diff] [blame] | 526 | |
| 527 | private: |
| 528 | std::vector<NonStandardGroupId> group_ids_; |
Taylor Brandstetter | e275174 | 2018-06-25 13:42:44 -0700 | [diff] [blame] | 529 | }; |
Mirko Bonadei | 759f161 | 2019-11-13 11:18:31 +0100 | [diff] [blame] | 530 | |
| 531 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 532 | RTCNonStandardStatsMember<bool>; |
| 533 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 534 | RTCNonStandardStatsMember<int32_t>; |
| 535 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 536 | RTCNonStandardStatsMember<uint32_t>; |
| 537 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 538 | RTCNonStandardStatsMember<int64_t>; |
| 539 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 540 | RTCNonStandardStatsMember<uint64_t>; |
| 541 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 542 | RTCNonStandardStatsMember<double>; |
| 543 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 544 | RTCNonStandardStatsMember<std::string>; |
| 545 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 546 | RTCNonStandardStatsMember<std::vector<bool>>; |
| 547 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 548 | RTCNonStandardStatsMember<std::vector<int32_t>>; |
| 549 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 550 | RTCNonStandardStatsMember<std::vector<uint32_t>>; |
| 551 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 552 | RTCNonStandardStatsMember<std::vector<int64_t>>; |
| 553 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 554 | RTCNonStandardStatsMember<std::vector<uint64_t>>; |
| 555 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 556 | RTCNonStandardStatsMember<std::vector<double>>; |
| 557 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 558 | RTCNonStandardStatsMember<std::vector<std::string>>; |
Byoungchan Lee | 0a52ede | 2021-05-22 08:41:02 +0900 | [diff] [blame] | 559 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 560 | RTCNonStandardStatsMember<std::map<std::string, uint64_t>>; |
| 561 | extern template class RTC_EXPORT_TEMPLATE_DECLARE(RTC_EXPORT) |
| 562 | RTCNonStandardStatsMember<std::map<std::string, double>>; |
Mirko Bonadei | 759f161 | 2019-11-13 11:18:31 +0100 | [diff] [blame] | 563 | |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 564 | } // namespace webrtc |
| 565 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 566 | #endif // API_STATS_RTC_STATS_H_ |