statstypes.cc revision 950c51825109c2ca352317edef0a33777d0e6678
15c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org/*
25c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org * libjingle
35c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@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
305c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.orgnamespace webrtc {
315c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
32c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeSession[] = "googLibjingleSession";
33c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeBwe[] = "VideoBwe";
34c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeRemoteSsrc[] = "remoteSsrc";
35c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeSsrc[] = "ssrc";
36c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeTrack[] = "googTrack";
37950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.orgconst char StatsReport::kStatsReportTypeIceLocalCandidate[] = "localcandidate";
38950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.orgconst char StatsReport::kStatsReportTypeIceRemoteCandidate[] =
39950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    "remotecandidate";
40c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeTransport[] = "googTransport";
41c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeComponent[] = "googComponent";
42c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeCandidatePair[] = "googCandidatePair";
43c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportTypeCertificate[] = "googCertificate";
44c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
45c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char StatsReport::kStatsReportVideoBweId[] = "bweforvideo";
46c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
47c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::StatsReport(const StatsReport& src)
48c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  : id(src.id),
49c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    type(src.type),
50c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    timestamp(src.timestamp),
51c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    values(src.values) {
52c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
53c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
54c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::StatsReport(const std::string& id)
55c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : id(id), timestamp(0) {
56c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
57c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
58c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport& StatsReport::operator=(const StatsReport& src) {
59c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(id == src.id);
60c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  type = src.type;
61c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  timestamp = src.timestamp;
62c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  values = src.values;
63c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return *this;
64c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
65c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
66c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Operators provided for STL container/algorithm support.
67c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator<(const StatsReport& other) const {
68c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id < other.id;
69c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
70c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
71c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator==(const StatsReport& other) const {
72c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id == other.id;
73c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
74c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
75c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Special support for being able to use std::find on a container
76c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// without requiring a new StatsReport instance.
77c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgbool StatsReport::operator==(const std::string& other_id) const {
78c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return id == other_id;
79c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
80c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
81c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// The copy ctor can't be declared as explicit due to problems with STL.
82c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(const Value& other)
83c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(other.name), value(other.value) {
84c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
85c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
86c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(StatsValueName name)
87c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(name) {
88c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
89c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
90c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value::Value(StatsValueName name, const std::string& value)
91c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    : name(name), value(value) {
92c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
93c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
94c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport::Value& StatsReport::Value::operator=(const Value& other) {
95c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const_cast<StatsValueName&>(name) = other.name;
96c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  value = other.value;
97c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return *this;
98c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
99c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
100c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgconst char* StatsReport::Value::display_name() const {
101c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org  switch (name) {
102c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAudioOutputLevel:
103c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "audioOutputLevel";
104c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAudioInputLevel:
105c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "audioInputLevel";
106c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameBytesSent:
107c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "bytesSent";
108c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePacketsSent:
109c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "packetsSent";
110c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameBytesReceived:
111c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "bytesReceived";
112c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePacketsReceived:
113c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "packetsReceived";
114c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePacketsLost:
115c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "packetsLost";
116c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTransportId:
117c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "transportId";
118c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameSsrc:
119c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "ssrc";
120c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org
121c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    // 'goog' prefixed constants.
122c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameActiveConnection:
123c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googActiveConnection";
124c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameActualEncBitrate:
125c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googActualEncBitrate";
126c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAvailableReceiveBandwidth:
127c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googAvailableReceiveBandwidth";
128c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAvailableSendBandwidth:
129c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googAvailableSendBandwidth";
130c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAvgEncodeMs:
131c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googAvgEncodeMs";
132c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameBucketDelay:
133c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googBucketDelay";
134c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameBandwidthLimitedResolution:
135c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googBandwidthLimitedResolution";
136c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCaptureJitterMs:
137c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCaptureJitterMs";
138c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCaptureQueueDelayMsPerS:
139c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCaptureQueueDelayMsPerS";
140950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org
141950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    // Candidate related attributes. Values are taken from
142950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    // http://w3c.github.io/webrtc-stats/#rtcstatstype-enum*.
143950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidateIPAddress:
144950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "ipAddress";
145950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidateNetworkType:
146950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "networkType";
147950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidatePortNumber:
148950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "portNumber";
149950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidatePriority:
150950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "priority";
151950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidateTransportType:
152950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "transport";
153950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameCandidateType:
154950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "candidateType";
155950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org
156c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameChannelId:
157c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googChannelId";
158c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCodecName:
159c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCodecName";
160c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameComponent:
161c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googComponent";
162c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameContentName:
163c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googContentName";
164c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCpuLimitedResolution:
165c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCpuLimitedResolution";
166c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingCTSG:
167c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingCTSG";
168c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingCTN:
169c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingCTN";
170c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingNormal:
171c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingNormal";
172c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingPLC:
173c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingPLC";
174c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingCNG:
175c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingCNG";
176c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodingPLCCNG:
177c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodingPLCCNG";
178c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDer:
179c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDerBase64";
180c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEchoCancellationQualityMin:
181c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEchoCancellationQualityMin";
182c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEchoDelayMedian:
183c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEchoCancellationEchoDelayMedian";
184c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEchoDelayStdDev:
185c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEchoCancellationEchoDelayStdDev";
186c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEchoReturnLoss:
187c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEchoCancellationReturnLoss";
188c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEchoReturnLossEnhancement:
189c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEchoCancellationReturnLossEnhancement";
190c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameEncodeUsagePercent:
191c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googEncodeUsagePercent";
192c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameExpandRate:
193c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googExpandRate";
194c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFingerprint:
195c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFingerprint";
196c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFingerprintAlgorithm:
197c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFingerprintAlgorithm";
198c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFirsReceived:
199c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFirsReceived";
200c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFirsSent:
201c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFirsSent";
202c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameHeightInput:
203c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameHeightInput";
204c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameHeightReceived:
205c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameHeightReceived";
206c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameHeightSent:
207c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameHeightSent";
208c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameRateReceived:
209c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameRateReceived";
210c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameRateDecoded:
211c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameRateDecoded";
212c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameRateOutput:
213c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameRateOutput";
214c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameDecodeMs:
215c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googDecodeMs";
216c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameMaxDecodeMs:
217c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googMaxDecodeMs";
218c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCurrentDelayMs:
219c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCurrentDelayMs";
220c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTargetDelayMs:
221c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTargetDelayMs";
222c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameJitterBufferMs:
223c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googJitterBufferMs";
224c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameMinPlayoutDelayMs:
225c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googMinPlayoutDelayMs";
226c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRenderDelayMs:
227c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRenderDelayMs";
228c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameCaptureStartNtpTimeMs:
229c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googCaptureStartNtpTimeMs";
230c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameRateInput:
231c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameRateInput";
232c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameRateSent:
233c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameRateSent";
234c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameWidthInput:
235c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameWidthInput";
236c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameWidthReceived:
237c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameWidthReceived";
238c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameFrameWidthSent:
239c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googFrameWidthSent";
240c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameInitiator:
241c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googInitiator";
242c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameIssuerId:
243c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googIssuerId";
244c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameJitterReceived:
245c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googJitterReceived";
246c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameLocalAddress:
247c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googLocalAddress";
248950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameLocalCandidateId:
249950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "localCandidateId";
250c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameLocalCandidateType:
251c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googLocalCandidateType";
252c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameLocalCertificateId:
253c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googLocalCertificateId";
254c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameAdaptationChanges:
255c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googAdaptationChanges";
256c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameNacksReceived:
257c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googNacksReceived";
258c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameNacksSent:
259c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googNacksSent";
260c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePlisReceived:
261c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googPlisReceived";
262c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePlisSent:
263c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googPlisSent";
264c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNamePreferredJitterBufferMs:
265c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googPreferredJitterBufferMs";
266c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameReadable:
267c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googReadable";
268c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRecvPacketGroupArrivalTimeDebug:
269c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googReceivedPacketGroupArrivalTimeDebug";
270c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRecvPacketGroupPropagationDeltaDebug:
271c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googReceivedPacketGroupPropagationDeltaDebug";
272c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRecvPacketGroupPropagationDeltaSumDebug:
273c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googReceivedPacketGroupPropagationDeltaSumDebug";
274c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRemoteAddress:
275c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRemoteAddress";
276950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org    case kStatsValueNameRemoteCandidateId:
277950c51825109c2ca352317edef0a33777d0e6678guoweis@webrtc.org      return "remoteCandidateId";
278c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRemoteCandidateType:
279c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRemoteCandidateType";
280c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRemoteCertificateId:
281c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRemoteCertificateId";
282c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRetransmitBitrate:
283c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRetransmitBitrate";
284c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameRtt:
285c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googRtt";
286c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameSendPacketsDiscarded:
287c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "packetsDiscardedOnSend";
288c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTargetEncBitrate:
289c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTargetEncBitrate";
290c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTransmitBitrate:
291c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTransmitBitrate";
292c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTransportType:
293c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTransportType";
294c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTrackId:
295c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTrackId";
296c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameTypingNoiseState:
297c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googTypingNoiseState";
298c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameViewLimitedResolution:
299c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googViewLimitedResolution";
300c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    case kStatsValueNameWritable:
301c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      return "googWritable";
302c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org    default:
303c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      ASSERT(false);
304c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org      break;
305c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org  }
306c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org
307c57310b982cdce138723de91d7b722f8199834abtommi@webrtc.org  return nullptr;
308c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
309c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
310c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name,
311c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                           const std::string& value) {
312c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  values.push_back(Value(name, value));
313c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
314c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
315c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name, int64 value) {
316c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, rtc::ToString<int64>(value));
317c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
318c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
319c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate <typename T>
320c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue(StatsReport::StatsValueName name,
321c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                           const std::vector<T>& value) {
322c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  std::ostringstream oss;
323c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  oss << "[";
324c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  for (size_t i = 0; i < value.size(); ++i) {
325c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    oss << rtc::ToString<T>(value[i]);
326c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    if (i != value.size() - 1)
327c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      oss << ", ";
328c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  }
329c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  oss << "]";
330c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, oss.str());
331c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
332c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
333c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Implementation specializations for the variants of AddValue that we use.
334c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// TODO(tommi): Converting these ints to strings and copying strings, is not
335c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// very efficient.  Figure out a way to reduce the string churn.
336c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
337c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<std::string>(
338c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<std::string>&);
339c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
340c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
341c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int>(
342c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<int>&);
343c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
344c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgtemplate
345c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddValue<int64_t>(
346c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    StatsReport::StatsValueName, const std::vector<int64_t>&);
347c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
348c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::AddBoolean(StatsReport::StatsValueName name, bool value) {
349c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  AddValue(name, value ? "true" : "false");
350c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
351c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
352c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgvoid StatsReport::ReplaceValue(StatsReport::StatsValueName name,
353c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org                               const std::string& value) {
354c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  for (Values::iterator it = values.begin(); it != values.end(); ++it) {
355c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    if ((*it).name == name) {
356c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      it->value = value;
357c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      return;
358c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org    }
359c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  }
360c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  // It is not reachable here, add an ASSERT to make sure the overwriting is
361c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  // always a success.
362c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(false);
363c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
364c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
365c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::StatsSet() {
366c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
367c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
368c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::~StatsSet() {
369c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
370c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
371c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::const_iterator StatsSet::begin() const {
372c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return list_.begin();
373c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
374c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
375c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsSet::const_iterator StatsSet::end() const {
376c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return list_.end();
377c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
378c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
379c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::InsertNew(const std::string& id) {
380c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  ASSERT(Find(id) == NULL);
381c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const StatsReport* ret = &(*list_.insert(StatsReportCopyable(id)).first);
382c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return const_cast<StatsReport*>(ret);
383c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
384c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
385c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::FindOrAddNew(const std::string& id) {
386c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  StatsReport* ret = Find(id);
387c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return ret ? ret : InsertNew(id);
388c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
389c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
390c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::ReplaceOrAddNew(const std::string& id) {
391c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  list_.erase(id);
392c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return InsertNew(id);
393c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
394c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org
395c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// Looks for a report with the given |id|.  If one is not found, NULL
396c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org// will be returned.
397c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.orgStatsReport* StatsSet::Find(const std::string& id) {
398c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  const_iterator it = std::find(begin(), end(), id);
399c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org  return it == end() ? NULL :
400c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org      const_cast<StatsReport*>(static_cast<const StatsReport*>(&(*it)));
401c9d155faebd5556c9ea86306dc15aa9dac0e13f7tommi@webrtc.org}
4025c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org
4035c3ee4bce6c61bb4095eb3746ba39d3eeab2ee93tommi@webrtc.org}  // namespace webrtc
404