statstypes.cc revision 7bea1ffe772e837d96f8faa5c9dd06e531b95379
15c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org/* 25c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * libjingle 35f93d0a140515e3b8cdd1b9a4c6f5871144e5deejlmiller@webrtc.org * Copyright 2014 Google Inc. 45c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 55c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * Redistribution and use in source and binary forms, with or without 65c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * modification, are permitted provided that the following conditions are met: 75c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 85c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 1. Redistributions of source code must retain the above copyright notice, 95c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * this list of conditions and the following disclaimer. 105c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 2. Redistributions in binary form must reproduce the above copyright notice, 115c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * this list of conditions and the following disclaimer in the documentation 125c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * and/or other materials provided with the distribution. 135c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 3. The name of the author may not be used to endorse or promote products 145c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * derived from this software without specific prior written permission. 155c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * 165c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 175c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 185c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 195c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 205c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 215c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 225c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 235c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 245c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 255c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 265c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org */ 275c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org 285c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org#include "talk/app/webrtc/statstypes.h" 295c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org 308e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.orgusing rtc::scoped_ptr; 318e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org 325c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.orgnamespace webrtc { 334fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgnamespace { 344fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 354fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// The id of StatsReport of type kStatsReportTypeBwe. 364fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgconst char kStatsReportVideoBweId[] = "bweforvideo"; 374fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 384fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// NOTE: These names need to be consistent with an external 394fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// specification (W3C Stats Identifiers). 404fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgconst char* InternalTypeToString(StatsReport::StatsType type) { 414fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org switch (type) { 424fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeSession: 434fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "googLibjingleSession"; 444fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeBwe: 454fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "VideoBwe"; 464fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeRemoteSsrc: 474fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "remoteSsrc"; 484fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeSsrc: 494fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "ssrc"; 504fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeTrack: 514fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "googTrack"; 524fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeIceLocalCandidate: 534fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "localcandidate"; 544fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeIceRemoteCandidate: 554fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "remotecandidate"; 564fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeTransport: 577bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "transport"; 584fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeComponent: 594fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "googComponent"; 604fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeCandidatePair: 614fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "googCandidatePair"; 624fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeCertificate: 634fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "googCertificate"; 644fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org case StatsReport::kStatsReportTypeDataChannel: 654fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "datachannel"; 664fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 674fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ASSERT(false); 684fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return nullptr; 69c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 70c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 714fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass BandwidthEstimationId : public StatsReport::Id { 724fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 734fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org BandwidthEstimationId() : StatsReport::Id(StatsReport::kStatsReportTypeBwe) {} 744fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { return kStatsReportVideoBweId; } 754fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 764fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 774fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass TypedId : public StatsReport::Id { 784fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 794fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org TypedId(StatsReport::StatsType type, const std::string& id) 804fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : StatsReport::Id(type), id_(id) {} 814fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 824fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org bool Equals(const Id& other) const override { 834fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return Id::Equals(other) && 844fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org static_cast<const TypedId&>(other).id_ == id_; 854fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 868e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org 874fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { 884fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return std::string(InternalTypeToString(type_)) + kSeparator + id_; 894fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 908e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org 914fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org protected: 924fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const std::string id_; 934fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 94c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 95322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.orgclass TypedIntId : public StatsReport::Id { 96322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org public: 97322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org TypedIntId(StatsReport::StatsType type, int id) 98322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org : StatsReport::Id(type), id_(id) {} 99322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org 100322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org bool Equals(const Id& other) const override { 101322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org return Id::Equals(other) && 102322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org static_cast<const TypedIntId&>(other).id_ == id_; 103322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org } 104322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org 105322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org std::string ToString() const override { 106322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org return std::string(InternalTypeToString(type_)) + 107322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org kSeparator + 108322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org rtc::ToString<int>(id_); 109322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org } 110322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org 111322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org protected: 112322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org const int id_; 113322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org}; 114322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org 1154fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass IdWithDirection : public TypedId { 1164fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 1174fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org IdWithDirection(StatsReport::StatsType type, const std::string& id, 1184fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport::Direction direction) 1194fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : TypedId(type, id), direction_(direction) {} 120c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 1214fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org bool Equals(const Id& other) const override { 1224fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return TypedId::Equals(other) && 1234fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org static_cast<const IdWithDirection&>(other).direction_ == direction_; 1244fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 125c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 1264fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { 1274fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ret(TypedId::ToString()); 128322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org ret += kSeparator; 1294fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += direction_ == StatsReport::kSend ? "send" : "recv"; 1304fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ret; 1314fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 132c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 1334fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org private: 1344fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const StatsReport::Direction direction_; 1354fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 1364fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1374fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass CandidateId : public TypedId { 1384fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 1394fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org CandidateId(bool local, const std::string& id) 1404fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : TypedId(local ? 1414fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport::kStatsReportTypeIceLocalCandidate : 1424fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport::kStatsReportTypeIceRemoteCandidate, 1434fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org id) { 1444fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 145c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 1464fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { 1474fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return "Cand-" + id_; 1484fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 1494fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 1504fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1514fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass ComponentId : public StatsReport::Id { 1524fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 1534fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ComponentId(const std::string& content_name, int component) 1544fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : ComponentId(StatsReport::kStatsReportTypeComponent, content_name, 1554fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org component) {} 1564fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1574fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org bool Equals(const Id& other) const override { 1584fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return Id::Equals(other) && 1594fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org static_cast<const ComponentId&>(other).component_ == component_ && 1604fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org static_cast<const ComponentId&>(other).content_name_ == content_name_; 1614fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 1624fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1634fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { 1644fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ToString("Channel-"); 1654fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 1664fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1674fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org protected: 1684fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ComponentId(StatsReport::StatsType type, const std::string& content_name, 1694fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org int component) 1704fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : Id(type), 1714fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org content_name_(content_name), 1724fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org component_(component) {} 1734fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1744fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString(const char* prefix) const { 1754fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ret(prefix); 1764fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += content_name_; 1774fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += '-'; 1784fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += rtc::ToString<>(component_); 1794fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ret; 1804fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 1814fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1824fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org private: 1834fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const std::string content_name_; 1844fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const int component_; 1854fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 1864fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1874fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgclass CandidatePairId : public ComponentId { 1884fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org public: 1894fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org CandidatePairId(const std::string& content_name, int component, int index) 1904fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org : ComponentId(StatsReport::kStatsReportTypeCandidatePair, content_name, 1914fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org component), 1924fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org index_(index) {} 1934fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1944fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org bool Equals(const Id& other) const override { 1954fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ComponentId::Equals(other) && 1964fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org static_cast<const CandidatePairId&>(other).index_ == index_; 1974fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 1984fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 1994fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ToString() const override { 2004fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org std::string ret(ComponentId::ToString("Conn-")); 2014fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += '-'; 2024fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ret += rtc::ToString<>(index_); 2034fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ret; 2044fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 2054fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 2064fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org private: 2074fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const int index_; 2084fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org}; 2094fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 2104fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} // namespace 2114fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 2124fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport::Id::Id(StatsType type) : type_(type) {} 2134fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport::Id::~Id() {} 2144fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 2154fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport::StatsType StatsReport::Id::type() const { return type_; } 216c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 2174fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgbool StatsReport::Id::Equals(const Id& other) const { 2184fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return other.type_ == type_; 219c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 220c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 221c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(StatsValueName name, const std::string& value) 222c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org : name(name), value(value) { 223c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 224c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 225c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char* StatsReport::Value::display_name() const { 226c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org switch (name) { 227c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAudioOutputLevel: 228c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "audioOutputLevel"; 229c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAudioInputLevel: 230c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "audioInputLevel"; 231c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameBytesSent: 232c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "bytesSent"; 233c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePacketsSent: 234c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "packetsSent"; 235c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameBytesReceived: 236c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "bytesReceived"; 237487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org case kStatsValueNameLabel: 238487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org return "label"; 239c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePacketsReceived: 240c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "packetsReceived"; 241c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePacketsLost: 242c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "packetsLost"; 243487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org case kStatsValueNameProtocol: 244487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org return "protocol"; 245c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTransportId: 246c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "transportId"; 2477bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org case kStatsValueNameSelectedCandidatePairId: 2487bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "selectedCandidatePairId"; 249c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameSsrc: 250c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "ssrc"; 251487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org case kStatsValueNameState: 252487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org return "state"; 253487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org case kStatsValueNameDataChannelId: 254487a4442152e2c70146aa2d2c6ccb370233c056cdecurtis@webrtc.org return "datachannelid"; 255c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org 256c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org // 'goog' prefixed constants. 257c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameActiveConnection: 258c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googActiveConnection"; 259c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameActualEncBitrate: 260c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googActualEncBitrate"; 261c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAvailableReceiveBandwidth: 262c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googAvailableReceiveBandwidth"; 263c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAvailableSendBandwidth: 264c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googAvailableSendBandwidth"; 265c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAvgEncodeMs: 266c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googAvgEncodeMs"; 267c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameBucketDelay: 268c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googBucketDelay"; 269c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameBandwidthLimitedResolution: 270c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googBandwidthLimitedResolution"; 271c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCaptureJitterMs: 272c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCaptureJitterMs"; 273c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCaptureQueueDelayMsPerS: 274c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCaptureQueueDelayMsPerS"; 275950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org 276950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org // Candidate related attributes. Values are taken from 277950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org // http://w3c.github.io/webrtc-stats/#rtcstatstype-enum*. 278950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidateIPAddress: 279950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "ipAddress"; 280950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidateNetworkType: 281950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "networkType"; 282950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidatePortNumber: 283950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "portNumber"; 284950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidatePriority: 285950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "priority"; 286950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidateTransportType: 287950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "transport"; 288950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameCandidateType: 289950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "candidateType"; 290950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org 291c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameChannelId: 292c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googChannelId"; 293c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCodecName: 294c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCodecName"; 295c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameComponent: 296c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googComponent"; 297c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameContentName: 298c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googContentName"; 299c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCpuLimitedResolution: 300c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCpuLimitedResolution"; 301c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingCTSG: 302c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingCTSG"; 303c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingCTN: 304c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingCTN"; 305c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingNormal: 306c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingNormal"; 307c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingPLC: 308c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingPLC"; 309c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingCNG: 310c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingCNG"; 311c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodingPLCCNG: 312c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodingPLCCNG"; 313c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDer: 314c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDerBase64"; 3157bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org case kStatsValueNameDtlsCipher: 3167bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "dtlsCipher"; 317c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEchoCancellationQualityMin: 318c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEchoCancellationQualityMin"; 319c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEchoDelayMedian: 320c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEchoCancellationEchoDelayMedian"; 321c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEchoDelayStdDev: 322c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEchoCancellationEchoDelayStdDev"; 323c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEchoReturnLoss: 324c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEchoCancellationReturnLoss"; 325c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEchoReturnLossEnhancement: 326c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEchoCancellationReturnLossEnhancement"; 327c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameEncodeUsagePercent: 328c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googEncodeUsagePercent"; 329c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameExpandRate: 330c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googExpandRate"; 331c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFingerprint: 332c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFingerprint"; 333c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFingerprintAlgorithm: 334c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFingerprintAlgorithm"; 335c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFirsReceived: 336c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFirsReceived"; 337c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFirsSent: 338c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFirsSent"; 339c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameHeightInput: 340c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameHeightInput"; 341c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameHeightReceived: 342c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameHeightReceived"; 343c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameHeightSent: 344c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameHeightSent"; 345c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameRateReceived: 346c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameRateReceived"; 347c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameRateDecoded: 348c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameRateDecoded"; 349c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameRateOutput: 350c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameRateOutput"; 351c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameDecodeMs: 352c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googDecodeMs"; 353c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameMaxDecodeMs: 354c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googMaxDecodeMs"; 355c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCurrentDelayMs: 356c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCurrentDelayMs"; 357c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTargetDelayMs: 358c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTargetDelayMs"; 359c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameJitterBufferMs: 360c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googJitterBufferMs"; 361c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameMinPlayoutDelayMs: 362c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googMinPlayoutDelayMs"; 363c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRenderDelayMs: 364c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googRenderDelayMs"; 365c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameCaptureStartNtpTimeMs: 366c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googCaptureStartNtpTimeMs"; 367c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameRateInput: 368c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameRateInput"; 369c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameRateSent: 370c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameRateSent"; 371c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameWidthInput: 372c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameWidthInput"; 373c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameWidthReceived: 374c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameWidthReceived"; 375c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameFrameWidthSent: 376c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googFrameWidthSent"; 377c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameInitiator: 378c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googInitiator"; 379c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameIssuerId: 380c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googIssuerId"; 381c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameJitterReceived: 382c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googJitterReceived"; 383c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameLocalAddress: 384c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googLocalAddress"; 385950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameLocalCandidateId: 386950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "localCandidateId"; 387c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameLocalCandidateType: 388c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googLocalCandidateType"; 389c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameLocalCertificateId: 3907bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "localCertificateId"; 391c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameAdaptationChanges: 392c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googAdaptationChanges"; 393c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameNacksReceived: 394c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googNacksReceived"; 395c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameNacksSent: 396c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googNacksSent"; 397c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePlisReceived: 398c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googPlisReceived"; 399c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePlisSent: 400c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googPlisSent"; 401c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNamePreferredJitterBufferMs: 402c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googPreferredJitterBufferMs"; 403c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameReadable: 404c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googReadable"; 405c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRecvPacketGroupArrivalTimeDebug: 406c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googReceivedPacketGroupArrivalTimeDebug"; 407c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRecvPacketGroupPropagationDeltaDebug: 408c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googReceivedPacketGroupPropagationDeltaDebug"; 409c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRecvPacketGroupPropagationDeltaSumDebug: 410c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googReceivedPacketGroupPropagationDeltaSumDebug"; 411c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRemoteAddress: 412c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googRemoteAddress"; 413950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org case kStatsValueNameRemoteCandidateId: 414950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org return "remoteCandidateId"; 415c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRemoteCandidateType: 416c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googRemoteCandidateType"; 417c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRemoteCertificateId: 4187bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "remoteCertificateId"; 419c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRetransmitBitrate: 420c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googRetransmitBitrate"; 421c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameRtt: 422c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googRtt"; 423652bc37a07f5ab2559fd217c22be391b45af5b53minyue@webrtc.org case kStatsValueNameSecondaryDecodedRate: 424652bc37a07f5ab2559fd217c22be391b45af5b53minyue@webrtc.org return "googSecondaryDecodedRate"; 425c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameSendPacketsDiscarded: 426c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "packetsDiscardedOnSend"; 427652bc37a07f5ab2559fd217c22be391b45af5b53minyue@webrtc.org case kStatsValueNameSpeechExpandRate: 428652bc37a07f5ab2559fd217c22be391b45af5b53minyue@webrtc.org return "googSpeechExpandRate"; 4297bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org case kStatsValueNameSrtpCipher: 4307bea1ffe772e837d96f8faa5c9dd06e531b95379pthatcher@webrtc.org return "srtpCipher"; 431c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTargetEncBitrate: 432c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTargetEncBitrate"; 433c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTransmitBitrate: 434c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTransmitBitrate"; 435c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTransportType: 436c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTransportType"; 437c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTrackId: 438c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTrackId"; 439c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameTypingNoiseState: 440c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googTypingNoiseState"; 441c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameViewLimitedResolution: 442c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googViewLimitedResolution"; 443c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org case kStatsValueNameWritable: 444c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return "googWritable"; 445c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org default: 446c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org ASSERT(false); 447c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org break; 448c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org } 449c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org 450c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org return nullptr; 451c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 452c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 453afa6d16a05301c462ff65aa4f1537a1aa12a0a7atommi@webrtc.orgconst std::string& StatsReport::Value::ToString() const { 454afa6d16a05301c462ff65aa4f1537a1aa12a0a7atommi@webrtc.org return value; 455afa6d16a05301c462ff65aa4f1537a1aa12a0a7atommi@webrtc.org} 456afa6d16a05301c462ff65aa4f1537a1aa12a0a7atommi@webrtc.org 4574fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport::StatsReport(scoped_ptr<Id> id) : id_(id.Pass()), timestamp_(0.0) { 4584fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ASSERT(id_.get()); 4594fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4604fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4614fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 4624fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewBandwidthEstimationId() { 4634fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new BandwidthEstimationId()).Pass(); 4644fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4654fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4664fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 4674fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewTypedId( 4684fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsType type, const std::string& id) { 4694fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new TypedId(type, id)).Pass(); 4704fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4714fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4724fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 473322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewTypedIntId(StatsType type, int id) { 474322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org return scoped_ptr<Id>(new TypedIntId(type, id)).Pass(); 475322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org} 476322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org 477322a564f49d9c995cfffbaabd3d8c5d5aa326e86decurtis@webrtc.org// static 4784fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewIdWithDirection( 4794fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsType type, const std::string& id, StatsReport::Direction direction) { 4804fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new IdWithDirection(type, id, direction)).Pass(); 4814fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4824fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4834fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 4844fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewCandidateId( 4854fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org bool local, const std::string& id) { 4864fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new CandidateId(local, id)).Pass(); 4874fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4884fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4894fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 4904fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewComponentId( 4914fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const std::string& content_name, int component) { 4924fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new ComponentId(content_name, component)).Pass(); 4934fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 4944fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 4954fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// static 4964fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgscoped_ptr<StatsReport::Id> StatsReport::NewCandidatePairId( 4974fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org const std::string& content_name, int component, int index) { 4984fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return scoped_ptr<Id>(new CandidatePairId(content_name, component, index)) 4994fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org .Pass(); 5004fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 5014fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 5024fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgconst char* StatsReport::TypeToString() const { 5034fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return InternalTypeToString(id_->type()); 5044fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 5054fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 506c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name, 507c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org const std::string& value) { 5088e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org values_.push_back(ValuePtr(new Value(name, value))); 509c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 510c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 511c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name, int64 value) { 512c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org AddValue(name, rtc::ToString<int64>(value)); 513c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 514c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5154fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org// TODO(tommi): Change the way we store vector values. 516c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate <typename T> 517c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name, 518c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org const std::vector<T>& value) { 519c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org std::ostringstream oss; 520c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org oss << "["; 521c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org for (size_t i = 0; i < value.size(); ++i) { 522c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org oss << rtc::ToString<T>(value[i]); 523c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org if (i != value.size() - 1) 524c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org oss << ", "; 525c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org } 526c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org oss << "]"; 527c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org AddValue(name, oss.str()); 528c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 529c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 530c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Implementation specializations for the variants of AddValue that we use. 531c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// TODO(tommi): Converting these ints to strings and copying strings, is not 532c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// very efficient. Figure out a way to reduce the string churn. 533c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate 534c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<std::string>( 535c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org StatsReport::StatsValueName, const std::vector<std::string>&); 536c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 537c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate 538c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int>( 539c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org StatsReport::StatsValueName, const std::vector<int>&); 540c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 541c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate 542c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int64_t>( 543c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org StatsReport::StatsValueName, const std::vector<int64_t>&); 544c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 545c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) { 5464fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org // TODO(tommi): Store bools as bool. 547c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org AddValue(name, value ? "true" : "false"); 548c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 549c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 550c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::ReplaceValue(StatsReport::StatsValueName name, 551c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org const std::string& value) { 5528e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org Values::iterator it = std::find_if(values_.begin(), values_.end(), 5538e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org [&name](const ValuePtr& v)->bool { return v->name == name; }); 5548e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org // Values are const once added since they may be used outside of the stats 5558e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org // collection. So we remove it from values_ when replacing and add a new one. 5568e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org if (it != values_.end()) { 5578e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org if ((*it)->value == value) 558c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org return; 5598e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org values_.erase(it); 560c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org } 5618e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org 5628e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org AddValue(name, value); 5638e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org} 5648e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org 5658e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.orgvoid StatsReport::ResetValues() { 5668e327c45d0940fd5bc46c3fe8d24363be07706actommi@webrtc.org values_.clear(); 567c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 568c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5694fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgconst StatsReport::Value* StatsReport::FindValue(StatsValueName name) const { 5704fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org Values::const_iterator it = std::find_if(values_.begin(), values_.end(), 5714fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org [&name](const ValuePtr& v)->bool { return v->name == name; }); 5724fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return it == values_.end() ? nullptr : (*it).get(); 5734fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 5744fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 5754fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsCollection::StatsCollection() { 576c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 577c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5784fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsCollection::~StatsCollection() { 5794fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org for (auto* r : list_) 5804fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org delete r; 581c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 582c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5834fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsCollection::const_iterator StatsCollection::begin() const { 584c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org return list_.begin(); 585c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 586c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5874fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsCollection::const_iterator StatsCollection::end() const { 588c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org return list_.end(); 589c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 590c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 5914fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgsize_t StatsCollection::size() const { 5924fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return list_.size(); 5934fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 5944fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 5954fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport* StatsCollection::InsertNew(scoped_ptr<StatsReport::Id> id) { 5964fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ASSERT(Find(*id.get()) == NULL); 5974fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport* report = new StatsReport(id.Pass()); 5984fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org list_.push_back(report); 5994fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return report; 600c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 601c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 6024fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport* StatsCollection::FindOrAddNew(scoped_ptr<StatsReport::Id> id) { 6034fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport* ret = Find(*id.get()); 6044fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return ret ? ret : InsertNew(id.Pass()); 605c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 606c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 6074fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport* StatsCollection::ReplaceOrAddNew(scoped_ptr<StatsReport::Id> id) { 6084fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org ASSERT(id.get()); 6094fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org Container::iterator it = std::find_if(list_.begin(), list_.end(), 6104fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org [&id](const StatsReport* r)->bool { return r->id().Equals(*id.get()); }); 6114fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org if (it != end()) { 6124fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org delete *it; 6134fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org StatsReport* report = new StatsReport(id.Pass()); 6144fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org *it = report; 6154fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return report; 6164fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org } 6174fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return InsertNew(id.Pass()); 618c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 619c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org 620c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Looks for a report with the given |id|. If one is not found, NULL 621c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// will be returned. 6224fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport* StatsCollection::Find(const StatsReport::Id& id) { 6234fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org Container::iterator it = std::find_if(list_.begin(), list_.end(), 6244fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org [&id](const StatsReport* r)->bool { return r->id().Equals(id); }); 6254fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return it == list_.end() ? nullptr : *it; 6264fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org} 6274fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org 6284fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.orgStatsReport* StatsCollection::Find(const scoped_ptr<StatsReport::Id>& id) { 6294fb7e2584326050a707aef544028fa9cb616ec89tommi@webrtc.org return Find(*id.get()); 630c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org} 6315c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org 6325c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org} // namespace webrtc 633