From 2293622f02f482bfc21763429e56f798e6267731 Mon Sep 17 00:00:00 2001 From: Jakob Ivarsson Date: Fri, 22 Mar 2019 11:29:49 +0100 Subject: [PATCH] Add group_ids to RTCStatsMemberInterface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: chromium:943076 Change-Id: I1bd40cbbd121dbc3c961650926d9a28fe90f6883 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128769 Commit-Queue: Jakob Ivarsson‎ Reviewed-by: Henrik Boström Cr-Commit-Position: refs/heads/master@{#27235} --- api/stats/rtc_stats.h | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/api/stats/rtc_stats.h b/api/stats/rtc_stats.h index ff793361eb..ed3765c3c2 100644 --- a/api/stats/rtc_stats.h +++ b/api/stats/rtc_stats.h @@ -179,6 +179,19 @@ class RTC_EXPORT RTCStats { return local_var_members_vec; \ } +// Non-standard stats members can be exposed to the JavaScript API in Chrome +// e.g. through origin trials. The group ID can be used by the blink layer to +// determine if a stats member should be exposed or not. Multiple non-standard +// stats members can share the same group ID so that they are exposed together. +enum class NonStandardGroupId { + // I2E: + // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/hE2B1iItPDk + kRtcAudioJitterBufferMaxPackets, + // I2E: + // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/YbhMyqLXXXo + kRtcStatsRelativePacketArrivalDelay, +}; + // Interface for |RTCStats| members, which have a name and a value of a type // defined in a subclass. Only the types listed in |Type| are supported, these // are implemented by |RTCStatsMember|. The value of a member may be @@ -214,6 +227,9 @@ class RTCStatsMemberInterface { // Is this part of the stats spec? Used so that chromium can easily filter // out anything unstandardized. virtual bool is_standardized() const = 0; + // Non-standard stats members can have group IDs in order to be exposed in + // JavaScript through experiments. Standardized stats have no group IDs. + virtual std::vector group_ids() const { return {}; } // Type and value comparator. The names are not compared. These operators are // exposed for testing. virtual bool operator==(const RTCStatsMemberInterface& other) const = 0; @@ -319,19 +335,6 @@ class RTC_EXPORT RTCStatsMember : public RTCStatsMemberInterface { T value_; }; -// Non-standard stats members can be exposed to the JavaScript API in Chrome -// e.g. through origin trials. The group ID can be used by the blink layer to -// determine if a stats member should be exposed or not. Multiple non-standard -// stats members can share the same group ID so that they are exposed together. -enum class NonStandardGroupId { - // I2E: - // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/hE2B1iItPDk - kRtcAudioJitterBufferMaxPackets, - // I2E: - // https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/YbhMyqLXXXo - kRtcStatsRelativePacketArrivalDelay, -}; - // Using inheritance just so that it's obvious from the member's declaration // whether it's standardized or not. template @@ -354,7 +357,9 @@ class RTCNonStandardStatsMember : public RTCStatsMember { bool is_standardized() const override { return false; } - std::vector group_ids() const { return group_ids_; } + std::vector group_ids() const override { + return group_ids_; + } T& operator=(const T& value) { return RTCStatsMember::operator=(value); } T& operator=(const T&& value) {